Rename and move file with Babel WebStorm filewatcher - webstorm

I'm trying to move to WebStorm (which I'm currently evaluating as a ST3 replacement) the following gulp workflow:
upon each file save
transpile with babel
inline sourcemaps
rename file from file.es6.js to file.js
move it from src/ tree to dist/ directory tree.
I've tried messing with it, for example:
--source-maps inline --stage 1 --out-dir dist/
gets me some results, but not renamed, and with $FileNameWithoutExtension$ I don't even know how to look into, extract that es6. part and remove it.

To have dist/file.js generated for each of your src/file.es6.js, try the following file watcher settings:
Arguments: --source-maps inline --out-file $ProjectFileDir$/dist/$FileDirRelativeToProjectRoot$/$FileNameWithoutAllExtensions$.js $FilePath$
Working directory: $FileDir$
Output paths to refresh: $ProjectFileDir$/dist/$FileDirRelativeToProjectRoot$/$FileNameWithoutAllExtensions$.js
I'm, however, not sure why you need replacing Gulp with file watchers - why not proceeding with Gulp? It works perfectly well with WebStorm

Related

How to use nodemon to watch a folder being deleted and added back with new files?

I have an app that generate build folder after building. Each time, the app will delete the whole build folder and add it back with new files inside.
I try to watch this folder change and do something.
nodemon --watch build --exec doSomething
However, this command will only watch if the build folder exists all the time and the file changes inside. It does not work when the whole folder got deleted and added back.
How to use nodemon to watch a folder got deleted and added back with new files with new files inside? Thanks
At least on MacOS, if the -L or --legacy-watch flags are used, nodemon stops working after the watched directory is deleted and fails to work correctly until the nodemon process is killed.
If the -L or --legacy-watch flags are omitted, nodemon works correctly after the watched directory is recreated.

File watcher: "An output directory must be specified when compiling a directory"

cmd.exe /D /C call C:\Users\sebas\AppData\Roaming\npm\node-sass.cmd style.scss:style.css
An output directory must be specified when compiling a directory
The scss file I want the file watcher to watch is placed at the root of my project.
Watch the error appear: gif_link
How do I fix this error?
If you like the .css files to be generated in the same folder as original file, try the following settings:
Note the Create output file from stdout option - it has to be enabled, as node-sass writes CSS to stdout unless the -o option is passed.
If you like to place generated files in a separate folder, use the -o option:
I got same error working with webpack bundler and setting my scripts in package.json
In my case to resolve this issue you need to add output directory ( -o name-of-directory).
If working with scripts in package.json it should look like this:
scripts: {
"scss": "node-sass --watch src -o src"
}
src is folder where sass file which I want to compile is placed.
It means compile sass from src folder and send compiled files to src folder.
In this case css file will be placed on same place where sass file already is.
With node-sass for me is working to set Arguments to
$FileName$ -o . $FileNameWithoutExtension$.css
and unchecked "Create output file from stdout".

WebStorm. How to make IDE compile less files from src/less/... to dist/css/...?

By default the .less files are compiled into the same directory.
But I want IDE compile to .less only from src/less/ and save .css to dist/css/ folder.
How can I do that?
Maybe I can mark folders as Sources and Destination? And then use FileDirRelativeToSourcepath?
UPDATE.
In older versions there was a "Mark as Sources".
In current version there is no this mark.
Why current version haven't this mark?
To have only files from src/less/ watched for changes, please create a custom scope in Settings | Appearance & Behavior | Scopes with only files from src/less/ included, and set this scope to your file watcher
To save output to a different folder, you need to modify 'Output paths to refresh' option (and, optionally, Arguments field - if you don't like creating output from stdout).
With stdout:
Arguments: --no-color $FileName$
Working dir: $FileDir$
Output paths to refresh: $ProjectFileDir$/dist/css/$FileDirPathFromParent(less)$$FileNameWithoutExtension$.css
Create output from stdout: checked
Without stdout:
Arguments: --no-color $FileName$ $ProjectFileDir$/dist/css/$FileDirPathFromParent(less)$$FileNameWithoutExtension$.css
Working dir: $FileDir$
Output paths to refresh: $ProjectFileDir$/dist/css/$FileDirPathFromParent(less)$$FileNameWithoutExtension$.css
Create output from stdout: unchecked
Screenshot with settings:

Replace text in broccoli-imported css file / ember-cli app

I am currently importing a css file from my bower_components folder in an ember-cli application, e.g.:
app.import('bower_components/toastr/toastr.min.css');
I'd like to modify the CSS in that file before it gets concatenated into vendor.css. How can I do a find a replace so that it ends up in vendor.css?
At this point, I've explored broccoli-replace a bit, but seems that that would only work if I wanted to have toastr.min built as a separate file in my dist folder. I'm not 100% understanding broccoli at the moment, so this could be way off.

Understanding of usage of Java2Wsdl for axis2/c

I have a problem with the installation of Java2Wsdl tool.
I have succesfully created and compiled(generated the .class file from the .java file) a simple Java class inside a directory /home/user/examples/com/mycompany/app.
In there I compile my SimpleClass and so, I have two files: SimpleClass.java & a SimpleClass.class .
Next, I have axis2/c installed on my ubuntu system
$ echo $AXIS2C_HOME
/usr/local/axis2c
I also have axis2/java installed
echo $AXIS2_HOME
/opt/axis2-1.6.2
I also downloaded, extracted and installed from this link the java2wsdl plugin.
This is how the bin directory looks like.
username#usernamePC:/opt/axis2-1.6.2/bin$ ls
axis2.bat axis2server.sh java2wsdl.bat setenv.sh wsdl2java.sh
axis2server.bat axis2.sh java2wsdl.sh wsdl2java.bat
Now, I want to convert my initial project from java to wsdl with java2wsdl but I cannot understand the right place of directory I should put that into, if I have the classpath(?) right and what would be the correct command for the conversion to happen.
I am trying something like that: Java2WSDL.sh -cn com.mycompany.app.SimpleClass
In here I put . instead of / and I am typing that in top directory, meaning com directory.
Can you help me out with this?
I am sorry for the long question but I needed to set all things right.
my-app was build with a simple maven project (maven 2.2.1) through this guide.
You should start codegeneration from build/classes directory.
That directory must have com and META-INF subdirs.
Example of generating WSDL:
# compile your project using ant or mvn
ant
# go to binary dir
cd build/classes
# check SimpleClass.class is here
ls com/mycompany/app/SimpleClass.class
# generate WSDL into current directory
$AXIS2_HOME/bin/java2wsdl.sh -cn com.mycompany.app.SimpleClass
# see generated WSDL
cat SimpleClass.wsdl
To generate WSDL into different directory append -o <directory> switch to command line of wsdl2java.sh script.