IntelliJ - compile all CoffeeScript files at once - intellij-idea

I use a CoffeeScript file watcher in IntelliJ to compile my CoffeeScript files. However, when I start the IDE, it does not interpret the files immediately. In the project structure, there are two files visible:
When I open the coffee file and change something, then the watcher is launched and compiles my script, which is also visible in the project structure:
Is there a way to tell IntelliJ that it should "precompile" all .coffee scripts in a project?
The problem is not only about the visibility of both .js and .coffee files. I want to store only .coffee files in the repository so initial compilation will be mandatory after the checkout.
I know I might use Grunt or even a coffee watcher to compile them, but my project involves a few really non-consoleable folks.

Related

IntelliJ SASS file watcher doesn't detect changes in SCSS file

I have a style.sass file that #uses several _*.sass partials. That was all working fine. Now I added a _*.scss file (it just contains a map, so I wanted it to be multiline), but editing that file does not trigger a rebuild of the style.sass file. I tried adding a SCSS file watcher too, since I'm not sure how IntelliJ decides what to watch, but that didn't help.
It works fine using Dart-SASS's --watch argument. How do I make IntelliJ do the same?
(Although it's a Play project, I'm using IntelliJ's file watchers because I wanted to be able to use #use, so I needed Dart SASS.)
The watcher can only listen to changes in files of same type (either SASS or SCSS), depending on the watcher settings, so you can't make the watcher work for both .scss and .sass files at the same time unless you use a custom scope with both .sass and .scss files included and set File Type: to Any:

UglifyJS file watcher in IntelliJ minifies already minified files during build

I have an UglifyJS file watcher set up in IntelliJ IDEA, and it works great while I'm editing -- I modify the source js, the minified version gets created next to it automatically.
However, when I run an Ant build, and it copies the minified versions into the build working dir, the watcher "helpfully" creates doubly minified versions of them (*.min.min.js) in the build working dir, not ok.
I've set the Scope of the watcher to the 'src' module, but apparently that doesn't do what you'd think it would, because the doubles get created when Ant copies files into the 'build' module. Happens when I use IDEA to manually copy a single file from src to build too.
I don't see how to set this up to include *.js but exclude *.min.js, which is really the right thing. (Seems so sensible that Uglify should have it built in, but far as I can see it doesn't.)
Other than getting rid of the watcher and scripting the build do the minification, or copying only the original js versions and letting the watcher (re)create the minified ones, what's the best way to go here?
Got this working, thanks to a helpful commenter on the IDEA forum. The key is setting up a custom Scope, which I tried to do before but failed.
Pattern I ended up with was this, for anyone with similar needs:
file[src]:*.js&&!file:*min.js*
Making the 'src' module current then opening the dlg and selecting it from the dropdown in the main watcher config window apparently doesn't actually filter by that module. Clicking the ... btn, then choosing it from the dlg that opens does, plus I added an explicit filename pattern to exclude already minified files too.
Works great now, far as I've tested (both a minimal Ant test and manually copying a file to 'build' in IDEA).
This is an old question, and perhaps the Watchers didn't have this functionality at the time.
Using JetBrains 'macro' codes makes the 'min.min.min.js' problem go away.
$FileNameWithoutAllExtensions$.js -m --source-map -o $ContentRoot$\prod\js\$FileNameWithoutAllExtensions$.min.js
I always set 'Scope' to 'Current File', too; why run uglify on files that haven't been altered? (I'm assuming that any 3rd party JS libraries are already minified).

LESSC to compile to a custom path using environment variable

Bottom line I need lessc to compile my main.less file to $CATALINA_EC_TMP/main.css
I'm working on this project, where I need to generate multiple output css files originating from the same source (LESS file) using LESSC.
So with Jet Brain's (WebStorm or IntelliJ Idea) File Watcher, I don't get much of options to save the output files to a custom path using an environment variable.
The reason why I use an environment variable is because some of the outputted files is in a temporary path (it changes whenever I deploy with ant)
That said ...
This is my Environment Variable:
$CATALINA_EC_TMP = '/foo/bar/'
and it's changing so in the next deployment, it won't be /foo/bar/ anymore.
and this is the command line that's being executed by my IDE to compile less files
/usr/local/bin/lessc --no-color main.less
I need lessc to compile my main.less file to $CATALINA_EC_TMP/main.css
so the resulting file would be in that case /foo/bar/main.css or wherever the $CATALINA_EC_TMP value is.
I hope that there's a solution to this, anyway if it doesn't exist I think I'll use fswatcher to copy my generated css files into my destinations whenever I compile.

WebStorm + CodeKit?

Does anyone know how to setup WebStorm to work with CodeKit on a mac?
The ultimate goal is to get codekit to run and compile the my scss when a file is saved in WebStorm.
May be I have miss understood your question but, webstorm can compile your scss files automatically whenever you change them. Why do you need codekit to run?
I was looking for the same answer. From my initial test, I had both CodeKit and Webstorm open together. When I had Webstorm compile the SCSS it produced the map file which helps debug the SCSS files and changed the scss in CodeKit. Whereas codekit does not produce the map but produces a config file. I guess that it depends on who else needs to work with your code.

Why does the default MVC 4 project include minified files?

I'm trying to get my head around bundles in MVC 4. From what I've read, you simply point it at a script or bunch of scripts, give it a name, and it'll bundle them up. If you're not in debug it will also minify them.
Sample Code:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
If it's done dynamically, why does the project have .min.js files for every script? Does the minifying process actually just load .min.js rather than minify it itself?
If you run in debug mode, the .debug.js files are included. If you run in release mode, the .min.js files are included. If the file is not .debug.js or .min.js, it's included in both cases.
In release mode, all the files, are minified and bundled in one file. No matter if they were or not were previously bundled.
I usually have the original, not .min.js or .debug.js files, and let the bundler do all the job of minification.
There is also another important thing you must be aware of: the bundler will reorder the included files according to internal rules. And, if you use wildcards, the files are included alfabetically. This can make fail your scripts if there are dependencies and they are included in the worng order. You can run your site in debug mode to check the order (look at the rendered script tags). If the order is wrong, you can tweak the file names or implement an IBundleOrderer.
This is a very interesting article on bundling.