WARNING - THIS PROJECT IS NO LONGER MAINTAINED!!!
JS Import Compiler is a node.js application that
looks for $import
calls recursively in the source JavaScript file and
resolves them in the destination file the same way as LESS/SCSS preprocessors resolve
@import rule in the output CSS.
- JSCS gives a way to reduce the number of HTTP requests by combining all scripts into a single one, what increases the application performance
- Being a build tool JSCS doesn't require any additional JavaScript on client-side
Define dependencies in your code:
src/main.js
var foo = $import( "./Form/Input/Tel" );
Create the dependency source:
src/Form/Input/Tel.js
function() {
return {
prop: "",
method: function(){}
}
}
Run the compiler:
node jsic.js src/main.js build/mail.js
Examine the combined file:
build/main.js
var foo = function() {
return {
prop: "",
method: function(){}
}
};
In order to have keep dependency source in in valid syntax from a linter prospective you can assign its body to module.exports, which is ignored by the compiler
/**
* The banner will be ignored by compiler
*/
module.exports = function() {
return {
prop: "",
method: function(){}
}
};
Please find instructions at https://github.com/dsheiko/grunt-jsic