From fdb8879a266f4c12a32c1d55fc1875fee5558012 Mon Sep 17 00:00:00 2001 From: PJ Date: Tue, 26 Sep 2017 11:49:21 -0400 Subject: [PATCH 1/3] exported readTemplatedStylesheetFromFile for use in nsg.js This is a hack --- lib/stylesheet/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/stylesheet/index.js b/lib/stylesheet/index.js index aa58eb4..2147e95 100644 --- a/lib/stylesheet/index.js +++ b/lib/stylesheet/index.js @@ -15,5 +15,6 @@ module.exports = { 'prefixed-css': require('./prefixed-css'), sass: readTemplatedStylesheetFromFile(path.join(__dirname, '/templates/sass.tpl')), scss: readTemplatedStylesheetFromFile(path.join(__dirname, '/templates/scss.tpl')), - stylus: readTemplatedStylesheetFromFile(path.join(__dirname, '/templates/stylus.tpl')) -}; \ No newline at end of file + stylus: readTemplatedStylesheetFromFile(path.join(__dirname, '/templates/stylus.tpl')), + readTemplatedStylesheetFromFile: readTemplatedStylesheetFromFile +}; From 435176172aba2e7f564ab12b63cd62d29acf35b1 Mon Sep 17 00:00:00 2001 From: PJ Date: Tue, 26 Sep 2017 11:53:09 -0400 Subject: [PATCH 2/3] use readTemplatedStylesheetFromFile fix the use of getTemplatedStylesheet in nsg.js when a custom template is used. --- lib/nsg.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/nsg.js b/lib/nsg.js index 97e5f4f..ee36bfd 100644 --- a/lib/nsg.js +++ b/lib/nsg.js @@ -13,7 +13,6 @@ var Promise = require('bluebird'), providedLayouts = require('./layout'), providedCompositors = require('./compositor'), providedStylesheets = require('./stylesheet'), - templatedStylesheet = require('./stylesheet/templatedStylesheet'), isNotNull = R.complement(R.isNil), MAX_PARALLEL_FILE_READS = 80, defaultOptions = { @@ -66,7 +65,7 @@ function generateSprite(userOptions, callback) { compositor = R.propOr(options.compositor, options.compositor, providedCompositors), renderStylesheet = R.cond([ [ R.both(R.is(String), R.has(R.__, providedStylesheets)), R.prop(R.__, providedStylesheets) ], - [ R.is(String), templatedStylesheet ], + [ R.is(String), providedStylesheets.readTemplatedStylesheetFromFile ], [ R.T, R.identity ] ])(options.stylesheet), readImage = R.propOr(null, 'readImage', compositor), From c340e4490b083c562db48933ecd457f1cc83fe30 Mon Sep 17 00:00:00 2001 From: PJ Date: Tue, 31 Oct 2017 16:58:41 -0400 Subject: [PATCH 3/3] Fix getRelativeSpriteDir Prevent it from clobbering existing, user-defined option --- lib/utils/stylesheet.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils/stylesheet.js b/lib/utils/stylesheet.js index fa5680b..7280b91 100644 --- a/lib/utils/stylesheet.js +++ b/lib/utils/stylesheet.js @@ -59,7 +59,7 @@ module.exports = { } return R.evolve({ - stylesheetOptions: R.merge(R.__, { spritePath: relativePath }) + stylesheetOptions: R.merge({ spritePath: relativePath }, R.__) }, options); } };