forked from yeoman/grunt-usemin
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
libs
, libs2min
, void
and remove
flows
`libs`: Concatinates only. Useful for vendor files if you want them separately and are using minified versions in developement(why?). `libs2min`: Concatenates only BUT transforms the source filename before like so: path/filename.js -> path/filename.min.js Useful if you use long versions in dev environment but want to use minified versions of vendor files in production, have those files around(bower!) and don't want to mess around minifying them yourself. `void`: Does nothing but replaces the block with new reference. Useful if you have the same block on multiple html files but don't want to concat or uglify it several times. `remove`: Does nothing but removes the block all together. Nothing is left even not the reference. Try them out.
- Loading branch information
Showing
4 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
var path = require('path'); | ||
|
||
exports.name = 'concat'; | ||
|
||
// | ||
// Output a config for the furnished block | ||
// The context variable is used both to take the files to be treated | ||
// (inFiles) and to output the one(s) created (outFiles). | ||
// It aslo conveys whether or not the current process is the last of the pipe | ||
// | ||
exports.createConfig = function(context, block) { | ||
var cfg = {files: []}; | ||
// FIXME: check context has all the needed info | ||
var outfile = path.join(context.outDir, block.dest); | ||
|
||
// Depending whether or not we're the last of the step we're not going to output the same thing | ||
var files = {}; | ||
files.dest = outfile; | ||
files.src = []; | ||
context.inFiles.forEach(function(f) { files.src.push(path.join(context.inDir, f));} ); | ||
cfg.files.push(files); | ||
context.outFiles = [block.dest]; | ||
return cfg; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
var path = require('path'); | ||
|
||
exports.name = 'concat'; | ||
|
||
// | ||
// Output a config for the furnished block | ||
// The context variable is used both to take the files to be treated | ||
// (inFiles) and to output the one(s) created (outFiles). | ||
// It aslo conveys whether or not the current process is the last of the pipe | ||
// | ||
exports.createConfig = function(context, block) { | ||
var cfg = {files: []}; | ||
// FIXME: check context has all the needed info | ||
var outfile = path.join(context.outDir, block.dest); | ||
|
||
// Depending whether or not we're the last of the step we're not going to output the same thing | ||
var files = {}; | ||
files.dest = outfile; | ||
files.src = []; | ||
context.inFiles.forEach(function(f) { files.src.push(path.join(context.inDir, f.replace(/\.js$/, '.min.js')));} ); | ||
cfg.files.push(files); | ||
context.outFiles = [block.dest]; | ||
return cfg; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters