Skip to content

Commit 390b46d

Browse files
author
benholloway
committed
updated tests for css assets, updated test references to appropriate tags
1 parent e89ad73 commit 390b46d

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

lib/build/node-sass.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ var path = require('path'),
1111
convert = require('convert-source-map'),
1212
SourceMapConsumer = require('source-map').SourceMapConsumer,
1313
mime = require('mime'),
14-
crypto = require('crypto');
14+
crypto = require('crypto'),
15+
defaults = require('lodash.defaults');
1516

1617
/**
1718
* Search for the relative file reference from the <code>startPath</code> up to the process
@@ -124,11 +125,17 @@ function embedRelativeURL(startPath, uri) {
124125
* @param {Array.<string>} [libraryPaths] Any number of library path strings
125126
* @returns {stream.Through} A through stream that performs the operation of a gulp stream
126127
*/
127-
module.exports = function (libraryPaths) {
128+
module.exports = function (options) {
129+
defaults(options, {
130+
libraryPaths: [],
131+
embedAssets : false
132+
});
133+
128134
var output = [],
129-
libList = (libraryPaths || []).filter(function isString(value) {
135+
libList = options.libraryPaths.filter(function isString(value) {
130136
return (typeof value === 'string');
131137
});
138+
132139
return through.obj(function (file, encoding, done) {
133140
var stream = this;
134141

@@ -269,12 +276,13 @@ module.exports = function (libraryPaths) {
269276
);
270277

271278
// rework css
272-
var reworked = rework(cssWithMap, '')
273-
.use(rewriteUriPlugin(pushAssetToOutput))
274-
.toString({
275-
sourcemap : true,
276-
sourcemapAsObject: true
277-
});
279+
var plugin = rewriteUriPlugin(options.embedAssets ? embedRelativeURL : pushAssetToOutput),
280+
reworked = rework(cssWithMap, '')
281+
.use(plugin)
282+
.toString({
283+
sourcemap : true,
284+
sourcemapAsObject: true
285+
});
278286

279287
// adjust overall sourcemap
280288
delete reworked.map.file;

tasks/css.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ function setUpTaskCss(context) {
4141
// compile sass with the previously discovered lib paths
4242
gulp.task('css:build', function () {
4343
return streams.scssApp()
44-
.pipe(nodeSass([streams.BOWER, streams.NODE]))
44+
.pipe(nodeSass({
45+
libraryPaths: [streams.BOWER, streams.NODE]
46+
}))
4547
.pipe(gulp.dest(streams.BUILD));
4648
});
4749
},

0 commit comments

Comments
 (0)