Do you know if it is possible to build a js file (jquery for example) with another file that contains coffeescript? The end result is to obtain a single JS file.
Use a build tool like Grunt.
Compile and merge coffeescript files with grunt contrib coffee and then use a build task to merge the javascript files and compiled coffeescript files into a single file: http://gruntjs.com/sample-gruntfile
You may also take a look at grunt contrib uglify
Related
I want to transpile JS files in a folder recursively and overwrite the same files with transpiled JS.
babel build/sample.js --out-file build/sample.js
Using the above command, I can transpile a single file. How could I do this recursively over a folder?
Edit:
I don't want to use Webpack.
My Source code will be in a different folder 'A' (with js.php files). And I use a PHP build process to generate a build folder 'B' (with .js files). I want to apply Babel on folder 'B' after generating the build folder.
I can't afford the time to make changes on to run Babel before the PHP build process now.
I have a site that contains the base javascript and css for a number of other sites. Most of the sites use a javascript bundle that has everything in it, although a few of them are lightweight and only use a few of the scripts. I'm learning how to use gulp to manipulate these files and mostly understand what's going on. However, I'd like to be able to perform the following sequence and I'm not sure how.
Compile my coffeescript files
Copy the compiled files to a folder
Minify the copied files
Bundle the compiled files into one file
Bundle the minified files into one file
Is there any way to make this happen all within one task?
Below the list of tools how u can do it. And the important one is documentation.
In short you have to create gulp task "build",for example, which will run tasks below.
gulp sequence
gulp coffee
gulp minify
gulp concat
and so on)
How to combine 2 or more JavaScript files in to a one file in PhpStorm (OR WebStorm).
I've searched and found just this result but it is not an answer:
Minifying JavaScript
I want something like this: Visual studio Bundler & Minifier plugin.
There's no built-in feature for that in IDE.
You can configure a grunt task inside IDE to concatenate files with https://github.com/gruntjs/grunt-contrib-concat
See also: Combine multiple JavaScript files into one JS file and
Combine and Minify Multiple CSS / JS Files
is there a way to minify all the JS file into a specific folder and output it into another file path? because currently i'm using a single process like this:
java -jar yuicompressor-2.4.7.jar "C:\QG\Website\YUI\dev\jqueryMain.js" -o "C:\QG\Website\YUI\prod\jqueryMain.min.js"
im using Win 10
Scenario: I currently have to work on a Coffescript project that is (at the moment still) tied to using some outdated and long forgotten browserify predecessor.
stitch : https://github.com/sstephenson/stitch
example output : https://gist.github.com/gilligan/00206343c41331ac9ce6
Question : What is the best approach for creating source-maps for the resulting file that is created from compiled coffeescript ? Would I have to add sourcemap generation to the stitch processing itself using something like https://github.com/mozilla/source-map/ or is there a more high-level/generic approach that could be applied in this scenario ?
For adding a source-map for coffee-script just use the node-js command line tool from the coffee-script package.
Example: (from coffeescript.org)
Compile a directory tree of .coffee files in src into a parallel tree of .js files in lib, plus creating the source map files:
coffee --compile --map --output lib/ src/
Personally I would do something like described in this tutorial - creating a sublime workflow.
Hope this helps!