Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

handlebar-rider

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handlebar-rider - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

81

lib/handlebar-rider.js
// handlebar rider
optimist = require('optimist')
handlebars = require('handlebars');

@@ -23,4 +23,4 @@ uglify = require('uglify-js');

templates_dir: 'app/handlebars/',
outfile: 'public/javascript/templates.js',
templates_dir: './app/handlebars/',
outfile: './public/javascript/templates.js',
templates: [],

@@ -90,3 +90,3 @@ minify: true

console.log(color.blue + '[handlebar-rider] New or removed file detected, recompiling' + color.reset);
readAndCompile();
readAndCompile(rider.templates_dir);

@@ -164,13 +164,14 @@ };

var readAndCompile = function(dir){
var readAndCompile = function(dir, argv){
try{
//read files in the directory
readTemplatesDirectory(dir, function(err, files) {
if (err) throw err;
rider.templates = []
for(var f = 0; f < files.length; f++){
try {
if(err)
throw new Error('Directory does not exists: ' + dir)
rider.templates = []
for(var f = 0; f < files.length; f++){

@@ -208,16 +209,53 @@ // determine whether or not it's a file or directory.

});
} catch(e){
} catch (e){
console.log(color.red + '[handlebar-rider] ERROR! Check to be sure your directories exist. ' + color.reset + "\n" + e + "\n");
console.log('[handlebar-rider] Input directory: ' + dir);
console.log('[handlebar-rider] Destination file: ' + rider.outfile + "\n");
if(rider.help)
console.log(rider.help)
}
});
console.log(color.red + '[handlebar-rider] ERROR! Check to be sure your directories exist. ' + color.reset + e);
}
}
}
// runs the command line
exports.run = function(){
// export for module use
//get options specified on command line
argv = optimist
.usage('Compile a directory of handlebars templates into a single javascript file.\nCommand Line Usage: ')
.alias('i','in')
.describe('i','Specify an input templates directory')
.default('i', rider.templates_dir)
.alias('o','out')
.describe('o','Specify an output file into which templates are compiled')
.default('o', rider.outfile)
.alias('r','readable')
.describe('r','Make the output more readable by avoiding default minification')
.default(false)
.argv
dir = argv.in;
rider.templates_dir = dir;
rider.minify = !argv.readable;
rider.outfile = argv.out;
rider.help = optimist.help()
//compile on startup
console.log(color.green + '[handlebar-rider] Compiling template directory ' + dir + ' to ' + rider.outfile + color.reset);
console.log(color.yellow + '[handlebar-rider] Watching template directory ' + dir + color.reset);
readAndCompile(dir, argv);
}
// export this function for module use
exports.readAndCompile = readAndCompile
exports.rider = rider
exports.color = color
exports.configure = function(config){ rider = config; }

@@ -227,1 +265,2 @@ })()

@@ -5,3 +5,3 @@ {

"description" : "Watches a directory and precompiles handlebars templates",
"version" : "0.1.4",
"version" : "0.1.5",

@@ -27,5 +27,6 @@ "repository" : {

"dependencies" : {
"handlebars" : "1.x",
"uglify-js" : "1.1.1"
"handlebars" : ">= 1.x",
"uglify-js" : "1.1.1",
"optimist" : ">= 0.3.4"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc