Transpond .es6.js files to nested .js file
Hi,
I'm trying to accomplish something which I feel like it should be possible but I can't seem to figure out how to do.
I am using WebStorm 9 and I'm trying to use traceur and a file watcher to transpond ES6 to ES5. Now all of this is working and I can specify a directory to which it should output the files. What I want to do goes a bit further. I only want to transpond files which end with '.es6' of file type '.js' and I want the resulting file te be nested below the original es6 file with one of those neat folding tree-view niffle thingies. Might this be possible? And if so, how do I go about doing this?
Thank you in advance!
Please sign in to leave a comment.
Please create a custom scope (Settings/Appearance&Behavior/Scopes) that includes .es6.js files only and then choose this scope in your file watcher settings
Normally you need to make sure that 'Output paths to refresh' option exactly matches the actual tool output to establish nesting
Hi thank you for the amazingly quick answer!
I have created a custom Scope which searches for all .es6.js files.
Now I call traceur like so:
--sourcemap --out $FilePathRelativeToProjectRoot$.lib.js $FilePathRelativeToProjectRoot$ --experimental
The parameter $FilePathRelativeToProjectRoot$.lib.js is the output name of the file, but what I would really like is:
--sourcemap --out $FilePathRelativeToProjectRoot$.replace(/.es6/, '') $FilePathRelativeToProjectRoot$ --experimental
This obviously does not work, but would like this be possible?
Solved: And lastly, I didn't quite understand:
Does this mean that "Output paths to refresh" needs to have the exact value of the file I'm transponing?
(again, I really appreciate the help)
After some trial and error I got nesting to work. Quite easy (in hindsight) and again a flawless feature of IntelliJ.
I am more and more impressed with every feature I uncover!
Now for the replace in $FilePathRelativeToProjectRoot$
I can suggest changing settings as follows:
does it work for you?
That works like a charm! Thank you very much for the reply.