miensol / grunt-concat-in-order Goto Github PK
View Code? Open in Web Editor NEWGruntjs plugin for concatenating files with dependency tree topological sort preserved.
License: MIT License
Gruntjs plugin for concatenating files with dependency tree topological sort preserved.
License: MIT License
Hello, sorry to bother you with that, it's probably not an issue but more a configuration problem because of my lack of understanding.
I tried to add your grunt plugin for the file based addition of .js files.
Using the code provided on your readme file, i have an error saying "'path' is not defined.", so here is my question, where and what should be the path defined as.
For now i am using your plugin manually with the default options and it work great, but i really wish i could use it the way it should be.
Thank you.
See #9 for example config. Getting this error:
Running "concat_in_order:app_js" (concat_in_order) task
Fatal error: Dependency required in node_modules/masonry-layout/dist/masonry.pkgd.min.js does not exist: jquery
This is false. jquery.min.js is the first line in "files" and is correctly included. This should print some sort of warning instead of error. Just because jquery does not provide/include "declare" lines does not mean things are wrong.
I have the following structure (the order of the files is explained further down):
/src/a.js:
framework.declare('ns.a');
/src/b.js:
framework.declare('ns.b');
/src/c.js:
framework.require('ns.a');
framework.require('ns.b');
framework.declare('ns.c');
/src/ns/d.js:
framework.require('ns.a');
framework.declare('ns.d');
/src/ns/moduleA/e.js;
framework.require('ns.c');
framework.declare('ns.moduleA.e');
/src/ns/moduleB/f.js:
framework.require('ns.c');
framework.declare('ns.moduleB.f')
/src/ns/moduleA/g.js:
framework.require('ns.c');
framework.require('ns.moduleB.f');
framework.declare('ns.moduleA.g');
/src/ns/moduleB/h.js:
framework.require('ns.c');
framework.declare('ns.moduleB.h')
/src/ns/moduleB/i.js:
framework.require('ns.c');
framework.require('ns.moduleB.h');
framework.declare('ns.moduleB.i');
/src/ns/moduleB/j.js:
framework.declare('ns.moduleB.j');
/src/ns/moduleA/k.js:
framework.require('ns.c');
framework.require('ns.moduleB.i');
framework.require('ns.moduleB.h');
framework.require('ns.moduleB.j');
framework.declare('ns.moduleA.k');
/src/ns/moduleC/l.js:
framework.require('ns.c');
framework.declare('ns.moduleC.l');
/src/ns/moduleC/m.js:
framework.require('ns.c');
framework.require('ns.moduleC.l');
framework.declare('ns.moduleC.m');
/src/ns/moduleB/n.js:
framework.require('ns.c');
framework.require('ns.moduleC.m');
framework.declare('ns.moduleB.n');
/src/moduleA/moduleA/o.js:
framework.require('ns.c');
framework.require('ns.moduleB.n');
framework.declare('ns.moduleA.o');
/src/moduleA/moduleD/p.js:
framework.declare('ns.moduleD.p');
/src/moduleA/moduleE/q.js:
framework.require('ns.c');
framework.require('ns.moduleD.p');
framework.declare('ns.moduleE.q');
/src/moduleA/moduleC/r.js:
framework.require('ns.c);
framework.require('ns.moduleE.q');
framework.require('ns.moduleC.m');
framework.declare('ns.moduleE.r');
/src/moduleA/moduleA/s.js:
framework.require('ns.c);
framework.require('ns.moduleE.r');
framework.declare('ns.moduleA.s');
I need the files to be concatenated in the exact same order as they are listed above (I think - at least that works). If I use Juicer (of course without the require and declare statements, and with depend comments instead), the end result will be a file with the order that I want.
However if I use concat-in-order, the result will be like this:
framework.declare('ns.a');
framework.declare('ns.b');
framework.require('ns.a');
framework.declare('ns.d');
framework.declare('ns.moduleD.p');
framework.declare('ns.moduleB.j');
framework.require('ns.a');
framework.require('ns.b');
framework.declare('ns.c');
framework.require('ns.c');
framework.declare('ns.moduleC.l');
framework.require('ns.c');
framework.require('ns.moduleD.p');
framework.declare('ns.moduleE.q');
framework.require('ns.c');
framework.declare('ns.moduleA.e');
framework.require('ns.c');
framework.declare('ns.moduleB.h');
framework.require('ns.c');
framework.require('ns.moduleB.h');
framework.declare('ns.moduleB.i');
framework.require('ns.c');
framework.declare('ns.moduleB.f');
framework.require('ns.c');
framework.require('ns.moduleC.l');
framework.declare('ns.moduleC.m');
framework.require('ns.c');
framework.require('ns.moduleB.i');
framework.require('ns.moduleB.h');
framework.require('ns.moduleB.j');
framework.declare('ns.moduleA.k');
framework.require('ns.c');
framework.require('ns.moduleB.f');
framework.declare('ns.moduleA.g');
framework.require('ns.c');
framework.require('ns.moduleC.m');
framework.declare('ns.moduleB.n');
framework.require('ns.c);
framework.require('ns.moduleE.q');
framework.require('ns.moduleC.m');
framework.declare('ns.moduleE.r');
framework.require('ns.c');
framework.require('ns.moduleB.n');
framework.declare('ns.moduleA.o');
framework.require('ns.c);
framework.require('ns.moduleE.r');
framework.declare('ns.moduleA.s');
The order becomes all wrong, and my javascript won't work.
I really don't want to use Juicer anymore as it requires Ruby, and the whole installation process with Juicer, Ruby, YUICompressor and what not, is pretty exhausting. So it would be a huge improvement to be able to use node, grunt and hopefully grunt-concat-in-order.
Consider this config. If a file is missing, no error is reported. Silently ignores and continues with concatenation.
concat_in_order: {
default_options: {
files: {
'static/js/app.js': [
'node_modules/jquery/dist/jquery.min.js',
'node_modules/bootstrap/dist/js/bootstrap.min.js',
'node_modules/d3/build/d3.min.js',
'node_modules/socket.io-client/dist/socket.io.slim.js',
'node_modules/js-storage/js.storage.min.js',
'node_modules/jquery.toaster/jquery.toaster.min.js',
'node_modules/notifyjs/dist/notify.min.js',
'node_modules/bootstrap-validator/dist/validator.min.js',
]
}
}
},
Steps:
mv node_modules/js-storage/js.storage.min.js /tmp/
grunt
Output:
Running "concat_in_order:default_options" (concat_in_order) task
File "static/js/app.js" created.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.