gulp-usemin
Advanced tools
Comparing version 0.3.12 to 0.3.13
module.exports = function(file, blocks, options, push, callback) { | ||
var path = require('path'); | ||
var gutil = require('gulp-util'); | ||
var Q = require('q'); | ||
var pipeline = require('./pipeline.js'); | ||
@@ -21,3 +20,3 @@ | ||
var promises = blocks.map(function(block, i) { | ||
return Q.Promise(function(resolve) { | ||
return new Promise(function(resolve) { | ||
if (typeof block == 'string') { | ||
@@ -45,3 +44,3 @@ html[i] = block; | ||
pipeline(block.name, block.files, block.tasks, function(file) { | ||
html[i] = '<script>' + String(file.contents) + '</script>' | ||
html[i] = '<script>' + String(file.contents) + '</script>'; | ||
resolve(); | ||
@@ -52,3 +51,4 @@ }.bind(this)); | ||
pipeline(block.name, block.files, block.tasks, function(file) { | ||
html[i] = '<style' + (block.mediaQuery ? ' media="' + block.mediaQuery + '"' : '') + '>' + String(file.contents) + '</style>'; | ||
html[i] = '<style' + (block.mediaQuery ? ' media="' + block.mediaQuery + '"' : '') + '>' | ||
+ String(file.contents) + '</style>'; | ||
resolve(); | ||
@@ -60,3 +60,3 @@ }.bind(this)); | ||
Q.all(promises).then(function() { | ||
Promise.all(promises).then(function() { | ||
var createdFile = createFile(name, html.join('')); | ||
@@ -63,0 +63,0 @@ pipeline(createdFile.path, [createdFile], options && options['html'], function(file) { |
module.exports = function(name, files, tasks, push) { | ||
var through = require('through2'); | ||
var concat = require('gulp-concat')(name || 'filename.temp', {newLine: require('os').EOL}); | ||
var concat = require('gulp-concat')(name || 'filename.temp', {newLine: '\n'}); | ||
@@ -5,0 +5,0 @@ /* PREPARE TASKS */ |
{ | ||
"name": "gulp-usemin", | ||
"version": "0.3.12", | ||
"version": "0.3.13", | ||
"description": "Replaces references to non-optimized scripts or stylesheets into a set of HTML files (or any templates/views).", | ||
@@ -10,4 +10,3 @@ "main": "index.js", | ||
"glob": "~4.0.4", | ||
"gulp-concat": "~2.4.1", | ||
"q": "~1.1.2" | ||
"gulp-concat": "~2.4.1" | ||
}, | ||
@@ -22,2 +21,3 @@ "devDependencies": { | ||
"gulp-minify-html": "~0.1.1", | ||
"gulp-foreach": "~0.1.0", | ||
"gulp-minify-css": "~0.3.0", | ||
@@ -24,0 +24,0 @@ "gulp-rev": "~0.4.2", |
@@ -20,2 +20,3 @@ # gulp-usemin | ||
var uglify = require('gulp-uglify'); | ||
var foreach = require('gulp-foreach'); | ||
var minifyHtml = require('gulp-minify-html'); | ||
@@ -25,12 +26,19 @@ var minifyCss = require('gulp-minify-css'); | ||
gulp.task('usemin', function () { | ||
/* | ||
* foreach is because usemin 0.3.11 won't manipulate | ||
* multiple files as an array. | ||
*/ | ||
gulp.task('usemin', function() { | ||
return gulp.src('./*.html') | ||
.pipe(usemin({ | ||
css: [minifyCss(), 'concat'], | ||
html: [minifyHtml({empty: true})], | ||
js: [uglify(), rev()], | ||
inlinejs: [uglify()], | ||
inlinecss: [minifyCss(), 'concat'] | ||
})) | ||
.pipe(gulp.dest('build/')); | ||
.pipe(foreach(function(stream, file) { | ||
return stream | ||
.pipe(usemin({ | ||
css: [ rev() ], | ||
html: [ minifyHtml({ empty: true }) ], | ||
js: [ uglify(), rev() ], | ||
inlinejs: [ uglify() ], | ||
inlinecss: [ minifyCss(), 'concat' ] | ||
})) | ||
.pipe(gulp.dest('build/')); | ||
})); | ||
}); | ||
@@ -185,2 +193,5 @@ ``` | ||
#####0.3.13 | ||
- works fine only with gulp-foreach | ||
#####0.3.12 | ||
@@ -187,0 +198,0 @@ - fixed #121 |
@@ -7,3 +7,2 @@ /* jshint node: true */ | ||
var assert = require('assert'); | ||
var es = require('event-stream'); | ||
var fs = require('fs'); | ||
@@ -480,8 +479,7 @@ var gutil = require('gulp-util'); | ||
compare('glob-inline-js.html', 'glob-inline-js.html', done); | ||
}) | ||
}); | ||
it('glob inline (css block)', function(done) { | ||
compare('glob-inline-css.html', 'glob-inline-css.html', done); | ||
}) | ||
}); | ||
}); | ||
@@ -488,0 +486,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41701
4
97
267
11
677