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

coffeecup

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coffeecup - npm Package Compare versions

Comparing version 0.3.13 to 0.3.14

6

CHANGELOG.md

@@ -1,2 +0,6 @@

**v0.3.13
**v0.3.14**
- compiler Added multi-file support to the -j option (thanks @ilogico)
- compiler --watch now works with multiple files (thanks @ilogico)
**v0.3.13**
- fix ie browser issues

@@ -3,0 +7,0 @@

// Generated by CoffeeScript 1.3.3
var OptionParser, argv, coffeecup, compile, fs, handle_error, log, options, path, switches, usage, write;
var OptionParser, argv, coffeecup, compile, fs, handle_error, log, options, path, switches, usage, watch, write;

@@ -24,6 +24,67 @@ coffeecup = require('./coffeecup');

watch = function(files, fn) {
var file, _i, _j, _len, _len1, _results, _results1;
if (false) {
_results = [];
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
_results.push((function() {
var currentFile;
currentFile = file;
return fs.watch(currentFile, function(event) {
if (event === 'change') {
return fn(currentFile);
}
});
})());
}
return _results;
} else {
_results1 = [];
for (_j = 0, _len1 = files.length; _j < _len1; _j++) {
file = files[_j];
_results1.push((function() {
var currentFile;
currentFile = file;
return fs.watchFile(currentFile, {
persistent: true,
interval: 500
}, function(curr, prev) {
if (!(curr.size === prev.size && curr.mtime.getTime() === prev.mtime.getTime())) {
return fn(currentFile);
}
});
})());
}
return _results1;
}
};
compile = function(input_path, output_directory, js, namespace) {
var appendTemplate, body, i;
if (namespace == null) {
namespace = 'templates';
}
if (Array.isArray(input_path)) {
i = 0;
body = '';
appendTemplate = function() {
var output;
if (i >= input_path.length || !options["package"]) {
output = "(function(){ \n this." + namespace + " || (this." + namespace + " = {});\n " + body + "\n}).call(this);";
return write(input_path[0], namespace, output, output_directory, '.js');
} else {
return fs.readFile(input_path[i], 'utf-8', function(err, contents) {
var func, name;
handle_error(err);
name = path.basename(input_path[i], path.extname(input_path[i]));
func = coffeecup.compile(contents, options);
body += "this." + namespace + "[" + (JSON.stringify(name)) + "] = " + func + ";\n";
i += 1;
return appendTemplate();
});
}
};
return appendTemplate();
}
return fs.readFile(input_path, 'utf-8', function(err, contents) {

@@ -72,6 +133,6 @@ var ext, func, name, output;

switches = [['-j', '--js', 'compile template to js function (template + embedded renderer)'], ['-b', '--bare', 'use with -j to compile template to js (template only)'], ['-c', '--core', 'use with -j to compile renderer to js (renderer only)'], ['-n', '--namespace [name]', 'global object holding the templates (default: "templates")'], ['-w', '--watch', 'watch templates for changes, and recompile'], ['-o', '--output [dir]', 'set the directory for compiled html'], ['-p', '--print', 'print the compiled html to stdout'], ['-f', '--format', 'apply line breaks and indentation to html output'], ['-u', '--utils', 'add helper locals (currently only "render")'], ['-z', '--optimize', 'optimize resulting JS'], ['-v', '--version', 'display coffeecup version'], ['-h', '--help', 'display this help message']];
switches = [['-j', '--js', 'compile template to js function (template + embedded renderer)'], ['-b', '--bare', 'use with -j to compile template to js (template only)'], ['-c', '--core', 'use with -j to compile renderer to js (renderer only)'], ['-n', '--namespace [name]', 'global object holding the templates (default: "templates")'], ['-w', '--watch', 'watch templates for changes, and recompile'], ['-o', '--output [dir]', 'set the directory for compiled html'], ['-p', '--print', 'print the compiled html to stdout'], ['-f', '--format', 'apply line breaks and indentation to html output'], ['-u', '--utils', 'add helper locals (currently only "render")'], ['-z', '--optimize', 'optimize resulting JS'], ['-v', '--version', 'display coffeecup version'], ['-h', '--help', 'display this help message'], ['-k', '--package', 'use with -j to include all templates in a single [namespace].js']];
this.run = function() {
var args, file, parser, _ref;
var args, file, files, parser, _i, _len, _ref, _results;
parser = new OptionParser(switches, usage);

@@ -98,16 +159,23 @@ options = parser.parse(argv);

if (args.length > 0) {
file = args[0];
files = args.slice(0);
if (options.watch) {
fs.watchFile(file, {
persistent: true,
interval: 500
}, function(curr, prev) {
if (curr.size === prev.size && curr.mtime.getTime() === prev.mtime.getTime()) {
return;
watch(files, function(file) {
if (options["package"] && options.js) {
return compile(files, options.output, options.js, options.namespace);
} else {
return compile(file, options.output, options.js, options.namespace);
}
return compile(file, options.output, options.js, options.namespace);
});
}
return compile(file, options.output, options.js, options.namespace);
if (options.js && options["package"]) {
return compile(files, options.output, options.js, options.namespace);
} else {
_results = [];
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
_results.push(compile(file, options.output, options.js, options.namespace));
}
return _results;
}
}
};

2

lib/coffeecup.js

@@ -18,3 +18,3 @@ // Generated by CoffeeScript 1.3.3

coffeecup.version = '0.3.13';
coffeecup.version = '0.3.14';

@@ -21,0 +21,0 @@ coffeecup.doctypes = {

{
"name": "coffeecup",
"description": "Markup as CoffeeScript.",
"version": "0.3.13",
"version": "0.3.14",
"author": "Kris Windham <kriswindham@gmail.com>",

@@ -6,0 +6,0 @@ "homepage": "http://easydoc.org/coffeecup",

Sorry, the diff of this file is not supported yet

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