New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

grunt-contrib-jst

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-contrib-jst - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

test/expected/amd_wrapper.js

32

docs/options.md

@@ -25,3 +25,33 @@ ##### files ```object```

```
##### prettify ```boolean```
When doing a quick once-over of your compiled template file, it's nice to see
an easy-to-read format that has one line per template. This will accomplish
that.
Example:
```javascript
options: {
prettify: true
}
```
##### amdWrapper ```boolean```
With Require.js and a pre-compiled template.js you want the templates to be
wrapped in a define. This will wrap the output in:
``` javascript
define(function() {
//Templates
return this["NAMESPACE"];
});
```
Example:
``` javascript
options: {
amdWrapper: true
}
```
##### processName ```function```

@@ -58,2 +88,2 @@

}
```
```

@@ -47,2 +47,27 @@ /*

},
pretty_amd: {
options: {
prettify: true,
amdWrapper: true
},
files: {
"tmp/pretty_amd.js": ["test/fixtures/template.html"]
}
},
prettify: {
options: {
prettify: true
},
files: {
"tmp/pretty.js": ["test/fixtures/template.html"]
}
},
amd_wrapper: {
options: {
amdWrapper:true
},
files: {
"tmp/amd_wrapper.js": ["test/fixtures/template.html"]
}
},
uglyfile: {

@@ -90,2 +115,2 @@ files: {

grunt.registerTask('default', 'lint test');
};
};

4

package.json
{
"name": "grunt-contrib-jst",
"description": "Precompile Underscore templates to JST file.",
"version": "0.3.1",
"version": "0.3.2",
"homepage": "https://github.com/gruntjs/grunt-contrib-jst",

@@ -25,3 +25,3 @@ "author": {

"engines": {
"node": "*"
"node": ">= 0.8.0"
},

@@ -28,0 +28,0 @@ "scripts": {

@@ -50,2 +50,33 @@ # grunt-contrib-jst [![Build Status](https://secure.travis-ci.org/gruntjs/grunt-contrib-jst.png?branch=master)](http://travis-ci.org/gruntjs/grunt-contrib-jst)

##### prettify ```boolean```
When doing a quick once-over of your compiled template file, it's nice to see
an easy-to-read format that has one line per template. This will accomplish
that.
Example:
```javascript
options: {
prettify: true
}
```
##### amdWrapper ```boolean```
With Require.js and a pre-compiled template.js you want the templates to be
wrapped in a define. This will wrap the output in:
``` javascript
define(function() {
//Templates
return this["NAMESPACE"];
});
```
Example:
``` javascript
options: {
amdWrapper: true
}
```
##### processName ```function```

@@ -86,2 +117,2 @@

*Task submitted by [Tim Branyen](http://github.com/tbranyen).*
*Task submitted by [Tim Branyen](http://github.com/tbranyen).*

@@ -47,2 +47,5 @@ /*

if (options.prettify) {
compiled = compiled.replace(/\n+/g, '');
}
filename = processName(file);

@@ -54,2 +57,11 @@ output.push(nsInfo.namespace+"["+JSON.stringify(filename)+"] = "+compiled+";");

output.unshift(nsInfo.declaration);
if (options.amdWrapper) {
if (options.prettify) {
output.forEach(function(line, index) {
output[index] = " " + line;
});
}
output.unshift("define(function(){");
output.push(" return " + nsInfo.namespace + ";\n});");
}
grunt.file.write(files.dest, output.join("\n\n"));

@@ -56,0 +68,0 @@ grunt.log.writeln("File '" + files.dest + "' created.");

@@ -9,3 +9,3 @@ var grunt = require('grunt');

test.expect(4);
test.expect(7);

@@ -27,5 +27,17 @@ expect = grunt.file.read("test/expected/jst.js");

test.equal(expect, result, "should define parts of nested namespaces, ignoring this.");
expect = grunt.file.read("test/expected/pretty.js");
result = grunt.file.read("tmp/pretty.js");
test.equal(expect, result, "should make the output be 1 line per template, making the output less ugly");
expect = grunt.file.read("test/expected/amd_wrapper.js");
result = grunt.file.read("tmp/amd_wrapper.js");
test.equal(expect, result, "should wrap the template with define for AMD pattern");
expect = grunt.file.read("test/expected/pretty_amd.js");
result = grunt.file.read("tmp/pretty_amd.js");
test.equal(expect, result, "should make the AMD wrapper output pretty");
test.done();
}
};
};

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