Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: register custom transformation #35

Open
srtucker22 opened this issue May 16, 2017 · 4 comments
Open

feature: register custom transformation #35

srtucker22 opened this issue May 16, 2017 · 4 comments

Comments

@srtucker22
Copy link
Contributor

srtucker22 commented May 16, 2017

using the 'medium transformation, i can expect an output like:

╔══════╗
║ diff ║
╚══════╝
 ┊ 6┊ 6┊  "main": "index.js",
 ┊ 7┊ 7┊  "author": "Simon Tucker <[email protected]>",
 ┊ 8┊ 8┊  "license": "MIT",
+┊  ┊ 9┊  "scripts": {
+┊  ┊10┊    "start": "nodemon --watch server --watch package.json server/index.js --exec babel-node --presets es2015,stage-2"
+┊  ┊11┊  },
 ┊ 9┊12┊  "devDependencies": {
 ┊10┊13┊    "babel-cli": "^6.24.1",
 ┊11┊14┊    "babel-preset-es2015": "^6.24.1",

But while I like that added/changed lines are bolded/italicised, I would prefer to remove the codeline numbers so the output looks like:

  "main": "index.js",
  "author": "Simon Tucker <;[email protected]>",
  "license": "MIT",
  "scripts": {
    "start": "nodemon --watch server --watch package.json server/index.js --exec babel-node --presets es2015,stage-2"
  },
  "devDependencies": {
    "babel-cli": "^6.24.1",
    "babel-preset-es2015": "^6.24.1",

So that people can simply copy/paste code.

I'm no RegExpert, so any help here would be much appreciated!

@srtucker22 srtucker22 changed the title register transformation that removes displaying codeline numbers register custom transformation May 16, 2017
@srtucker22
Copy link
Contributor Author

ok so maybe something like this?
replace(/┊? ?([0-9]|).*┊/mg, '')

but I want to be able to register my custom transformation and apply it with tortilla easily. Hoping there's a nice way to do this? Maybe pass a plugin or config or something?

@DAB0mB
Copy link
Collaborator

DAB0mB commented May 17, 2017

@srtucker22 There is a way actually but it is not exposed to the user yet. We will be happy to accept pull requests which do that :-)

@srtucker22
Copy link
Contributor Author

already started, but could use some help :)

my main challenge here is having a consistent config file throughout the rendering or whatever process. for example, if I create a .tortillarc.js file in my project's root directory at step x, is there a way that I can always use the most recent version (the latest step) of .tortillarc.js to apply to all the steps when I run tortilla manual render --all?

@DAB0mB
Copy link
Collaborator

DAB0mB commented May 17, 2017

@srtucker22 First of all I wouldn't create a .tortillarc.js but rather define the config inside the .tortilla dir or package.json file, no need to create extra fs. Second, I recommend you to look at the local-storage module where you can store variables and use them afterwards in completely different processes when running Tortilla operations. The logic of Tortilla ain't simple at all and it will take you some time to get used to it, but after you do so you'll see that the architecture of it is really well made. Thank you very much for contributing! Once you finish just open a pull request and I will go through it and tell you my thoughts.

@srtucker22 srtucker22 changed the title register custom transformation feature: register custom transformation Jun 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants