Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CSS-Tricks/The-Printliminator.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMottie <wowmotty@gmail.com>2015-09-15 07:51:05 +0300
committerMottie <wowmotty@gmail.com>2015-09-15 07:51:05 +0300
commit195df4b3a2519f470c8eb089918690eff8f673c9 (patch)
tree2969cffaedfa99075ff055fbe41546b1e73810a0 /Gruntfile.js
parentad80a1198f2a960654a0180a3fb6e3e53d6eecc1 (diff)
Add bookmark.html to grunt build
Diffstat (limited to 'Gruntfile.js')
-rw-r--r--Gruntfile.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/Gruntfile.js b/Gruntfile.js
index e307ff9..de21abd 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -14,6 +14,7 @@ module.exports = function( grunt ) {
// bookmarklet builder URLs
indexHtml : 'index.html',
+ bookmarkHtml : 'bookmark.html',
production : {
printliminator : '//css-tricks.github.io/The-Printliminator/printliminator.min.js'
},
@@ -95,16 +96,21 @@ module.exports = function( grunt ) {
var content = grunt.file.read( config.bookmarkletJs + '.min.js' ),
// load index.html template
baseHtml = grunt.file.read( config.src + config.indexHtml ),
+ bookmarkHtml = grunt.file.read( config.src + config.bookmarkHtml ),
modFile = function( mode ) {
- var file = content
+ var regex = new RegExp('\\{' + mode + '\\}'),
+ file = content
.replace( /\{printliminator\}/, config[ mode ].printliminator )
.replace( /\"/g, "'" )
// not using encodeURI because it changes "{}" into "%7B%7D"
// and just makes the bookmarklet bigger & harder to read
.replace( /\x20/g, '%20' );
// add javascript to HTML
- baseHtml = baseHtml.replace( new RegExp('\\{' + mode + '\\}'), file );
+ baseHtml = baseHtml.replace( regex, file );
+ if ( mode === 'production' ) {
+ bookmarkHtml = bookmarkHtml.replace( regex, file );
+ }
};
// update production & dev bookmarklet href
@@ -117,6 +123,7 @@ module.exports = function( grunt ) {
// write modified index.html
grunt.file.write( config.indexHtml, baseHtml );
+ grunt.file.write( config.bookmarkHtml, bookmarkHtml );
});
grunt.registerTask( 'default', 'Default build', function() {