gulp-usemin
Advanced tools
Comparing version 0.3.11 to 0.3.12
@@ -0,0 +0,0 @@ /* jshint node:true */ |
@@ -0,0 +0,0 @@ module.exports = function(options) { |
@@ -19,2 +19,3 @@ var fs = require('fs'); | ||
var mainPath = path.dirname(file.path); | ||
var outputPath = options.outputRelativePath || ''; | ||
var content = String(file.contents); | ||
@@ -86,5 +87,5 @@ var sections = content.split(endReg); | ||
blocks.push({ | ||
type: 'js', | ||
type: section[1].indexOf('inline') !== -1 ? 'inlinejs' : 'js', | ||
nameInHTML: section[3], | ||
name: section[4], | ||
name: outputPath + section[4], | ||
files: getFiles(section[5], jsReg, section[2]), | ||
@@ -95,5 +96,5 @@ tasks: options[section[1]] | ||
blocks.push({ | ||
type: 'css', | ||
type: section[1].indexOf('inline') !== -1 ? 'inlinecss' : 'css', | ||
nameInHTML: section[3], | ||
name: section[4], | ||
name: outputPath + section[4], | ||
files: getFiles(section[5], cssReg, section[2]), | ||
@@ -100,0 +101,0 @@ tasks: options[section[1]], |
@@ -42,2 +42,14 @@ module.exports = function(file, blocks, options, push, callback) { | ||
} | ||
else if (block.type == 'inlinejs') { | ||
pipeline(block.name, block.files, block.tasks, function(file) { | ||
html[i] = '<script>' + String(file.contents) + '</script>' | ||
resolve(); | ||
}.bind(this)); | ||
} | ||
else if (block.type == 'inlinecss') { | ||
pipeline(block.name, block.files, block.tasks, function(file) { | ||
html[i] = '<style' + (block.mediaQuery ? ' media="' + block.mediaQuery + '"' : '') + '>' + String(file.contents) + '</style>'; | ||
resolve(); | ||
}.bind(this)); | ||
} | ||
}); | ||
@@ -47,3 +59,4 @@ }); | ||
Q.all(promises).then(function() { | ||
pipeline(name, [createFile(name, html.join(''))], options && options['html'], function(file) { | ||
var createdFile = createFile(name, html.join('')); | ||
pipeline(createdFile.path, [createdFile], options && options['html'], function(file) { | ||
callback(null, file); | ||
@@ -50,0 +63,0 @@ }); |
module.exports = function(name, files, tasks, push) { | ||
var through = require('through2'); | ||
var concat = require('gulp-concat')(name, {newLine: require('os').EOL}); | ||
var concat = require('gulp-concat')(name || 'filename.temp', {newLine: require('os').EOL}); | ||
@@ -5,0 +5,0 @@ /* PREPARE TASKS */ |
{ | ||
"name": "gulp-usemin", | ||
"version": "0.3.11", | ||
"version": "0.3.12", | ||
"description": "Replaces references to non-optimized scripts or stylesheets into a set of HTML files (or any templates/views).", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -29,3 +29,5 @@ # gulp-usemin | ||
html: [minifyHtml({empty: true})], | ||
js: [uglify(), rev()] | ||
js: [uglify(), rev()], | ||
inlinejs: [uglify()], | ||
inlinecss: [minifyCss(), 'concat'] | ||
})) | ||
@@ -74,2 +76,12 @@ .pipe(gulp.dest('build/')); | ||
<!-- endbuild --> | ||
<!-- build:inlinejs --> | ||
<script src="../lib/angular-min.js"></script> | ||
<script src="../lib/angular-animate-min.js"></script> | ||
<!-- endbuild --> | ||
<!-- build:inlinecss --> | ||
<link rel="stylesheet" href="css/clear.css"/> | ||
<link rel="stylesheet" href="css/main.css"/> | ||
<!-- endbuild --> | ||
``` | ||
@@ -173,2 +185,5 @@ | ||
#####0.3.12 | ||
- fixed #121 | ||
#####0.3.11 | ||
@@ -175,0 +190,0 @@ - fixed #88 |
var sample = 111; | ||
console.log(sample); |
var sample=111; | ||
console.log(sample); |
var sample = 111; | ||
console.log(sample); |
alert(1); |
@@ -179,3 +179,3 @@ /* jshint node: true */ | ||
it('simple css block with single quotes', function (done) { | ||
compare('single-quotes-js.html', 'single-quotes-js.html', done); | ||
compare('single-quotes-css.html', 'single-quotes-css.html', done); | ||
}); | ||
@@ -445,2 +445,11 @@ | ||
}); | ||
it('conditional (inline js block)', function(done) { | ||
compare('conditional-inline-js.html', 'conditional-inline-js.html', done); | ||
}); | ||
it('conditional (inline css block)', function(done) { | ||
compare('conditional-inline-css.html', 'conditional-inline-css.html', done); | ||
}); | ||
}); | ||
@@ -469,2 +478,11 @@ | ||
}); | ||
it('glob inline (js block)', function(done) { | ||
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); | ||
}) | ||
}); | ||
@@ -496,2 +514,34 @@ | ||
describe('inline Sources:', function() { | ||
function compare(fixtureName, name, end) { | ||
var stream = usemin(); | ||
stream.on('data', function(newFile) { | ||
if (path.basename(newFile.path) === name) { | ||
assert.equal(String(newFile.contents), String(getExpected(name).contents)); | ||
end(); | ||
} | ||
}); | ||
stream.write(getFixture(fixtureName)); | ||
} | ||
it('simple inline js block', function (done) { | ||
compare('simple-inline-js.html', 'simple-inline-js.html', done); | ||
}); | ||
it('simple inline css block', function (done) { | ||
compare('simple-inline-css.html', 'simple-inline-css.html', done); | ||
}); | ||
it('simple inline js block width single quotes', function (done) { | ||
compare('single-quotes-inline-js.html', 'single-quotes-inline-js.html', done); | ||
}); | ||
it('simple inline css block with single quotes', function (done) { | ||
compare('single-quotes-inline-css.html', 'single-quotes-inline-css.html', done); | ||
}); | ||
}); | ||
it('async task', function(done) { | ||
@@ -498,0 +548,0 @@ var less = require('gulp-less'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
41440
95
678
256