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

grunt-angular-templates

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-angular-templates - npm Package Compare versions

Comparing version 0.4.9 to 0.4.10

tasks/lib/appender.js

51

Gruntfile.js

@@ -17,2 +17,12 @@ /*

},
copy: {
tmp: {
files: [{
expand: true,
cwd: 'test/fixtures',
src: ['usemin.html', 'usemin/*'],
dest: 'tmp/'
}]
}
},
nodeunit: {

@@ -28,16 +38,4 @@ tests: ['test/*.js']

options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
node: true,
es5: true
},
globals: {}
jshintrc: '.jshintrc',
}
},

@@ -53,2 +51,13 @@ concat: {

},
usemin: {
html: 'tmp/usemin.html'
},
useminPrepare: {
html: 'test/fixtures/usemin.html',
options: {
dest: 'tmp',
staging: 'tmp'
}
},
cssmin: {},

@@ -86,2 +95,10 @@ // All supported examples should be here

custom_usemin: {
src: ['test/fixtures/one.html', 'test/fixtures/two/**/*.html'],
dest: 'tmp/custom_concat_usemin.js',
options: {
usemin: 'usemin/all.js'
}
},
html5: {

@@ -227,6 +244,10 @@ src: ['test/fixtures/html5.html'],

grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-usemin');
grunt.registerTask('default', ['jshint', 'clean', 'ngtemplates', 'concat', 'nodeunit']);
grunt.registerTask('default', ['jshint', 'clean', 'copy', 'useminPrepare', 'ngtemplates', 'concat', 'uglify', 'cssmin', 'usemin', 'nodeunit']);
};
{
"name": "grunt-angular-templates",
"description": "Grunt build task to concatenate & register your AngularJS templates in the $templateCache",
"version": "0.4.9",
"version": "0.4.10",
"homepage": "https://github.com/ericclemmons/grunt-angular-templates",

@@ -35,7 +35,11 @@ "author": {

"grunt": "~0.4.0",
"grunt-cli": "~0.1.6",
"grunt-contrib-cssmin": "~0.7.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-jshint": "~0.1.1",
"grunt-contrib-nodeunit": "~0.1.2",
"grunt-cli": "~0.1.6"
"grunt-contrib-jshint": "~0.7.2",
"grunt-contrib-nodeunit": "~0.2.2",
"grunt-contrib-uglify": "~0.2.7",
"grunt-usemin": "~2.0.2",
"grunt-contrib-copy": "~0.4.1"
},

@@ -42,0 +46,0 @@ "keywords": [

@@ -158,3 +158,9 @@ # grunt-angular-templates

### usemin
> Path to `<!-- build:js [path/to/output.js] -->` usemin target
This should be the output path of the compiled JS indicated in your HTML,
such as `path/to/output.js` shown here.
## Usage

@@ -208,9 +214,11 @@

```html
<!-- build:js combined.js -->
<!-- build:js dist/vendors.js -->
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<!-- endbuild -->
```
The name of your `build:js` file automatically becomes the `concat` target
name. So, simply just copy/paste that name into the `concat` option:
**Do not use the `concat` option**, even though grunt-usemin generates a `concat.generated`
object behind the scenes. Instead, use the `usemin` option to indicate the anticipated
output filepath from grunt-usemin.

@@ -223,3 +231,3 @@ ```js

options: {
concat: 'combined.js'
usemin: 'dist/vendors.js' // <~~ This came from the <!-- build:js --> block
}

@@ -230,2 +238,7 @@ }

**Note**: Earlier versions of grunt-usemin (*correctly, in my opinion*) would have generated
a `concat['dist/vendors.js']` object for each build section in the HTML. Now,
because there's a single `concat.generated` object with **all** JS/CSS files within it,
I'm back-tracking the proper `concat` target for you.
## Examples

@@ -340,2 +353,3 @@

- v0.4.10 – Add `usemin` option
- v0.4.9 – Improve `prefix` and support for URLs ([#57](https://github.com/ericclemmons/grunt-angular-templates/pull/57))

@@ -342,0 +356,0 @@ - v0.4.8 – Compiled assets are JSHint-able ([#58](https://github.com/ericclemmons/grunt-angular-templates/pull/58))

@@ -12,4 +12,3 @@ /*

var Compiler = require('./lib/compiler');
var path = require('path');
var util = require('util');
var Appender = require('./lib/appender');

@@ -32,3 +31,3 @@ module.exports = function(grunt) {

grunt.registerMultiTask('ngtemplates', 'Compile AngularJS templates for $templateCache', function() {
var ngtemplatesTask = function() {
var options = this.options({

@@ -43,3 +42,4 @@ angular: 'angular',

standalone: false,
url: function(path) { return path; }
url: function(path) { return path; },
usemin: null,
});

@@ -55,2 +55,3 @@

var compiler = new Compiler(grunt, options, file.cwd);
var appender = new Appender(grunt);
var modules = compiler.modules(file.src);

@@ -66,37 +67,18 @@ var compiled = [];

// Append file.dest to specified concat target
if (options.concat) {
if (process.platform === 'win32') {
options.concat = options.concat.replace(/\//g, '\\');
if (options.usemin) {
if (appender.save('generated', appender.concatUseminFiles(options.usemin, file))) {
grunt.log.writeln('Added ' + file.dest.cyan + ' to ' + ('<!-- build:js ' + options.usemin + ' -->').yellow);
}
}
var config = grunt.config(['concat', options.concat]);
if (!config) {
grunt.log.warn('Concat target not found: ' + options.concat.red);
return false;
if (options.concat) {
if (appender.save(options.concat, appender.concatFiles(options.concat, file))) {
grunt.log.writeln('Added ' + file.dest.cyan + ' to ' + ('concat:' + options.concat).yellow);
}
// Grunt handles files 400 different ways. Not me.
var normal = grunt.task.normalizeMultiTaskFiles(config, options.concat);
var files = normal.map(function(files) {
files.src.push(file.dest);
delete files.orig;
return files;
});
grunt.log.writeln('Added ' + file.dest.cyan + ' to ' + ('concat:' + options.concat).yellow);
// Re-save processed concat target
grunt.config(['concat', options.concat], {
files: files,
options: config.options || {}
});
}
});
});
};
grunt.registerMultiTask('ngtemplates', 'Compile AngularJS templates for $templateCache', ngtemplatesTask);
};

@@ -12,3 +12,3 @@ /*

var minify = require('html-minifier').minify;
var Url = require('url');
var Url = require('url');

@@ -15,0 +15,0 @@ /**

@@ -38,2 +38,14 @@ 'use strict';

custom_usemin: function(test) {
test.expect(5);
test.equal(grunt.file.read('test/expected/usemin.html'), grunt.file.read('tmp/usemin.html'));
test.equal(grunt.file.read('test/expected/usemin/foo.js').slice(0, -1), grunt.file.read('tmp/usemin/foo.js'));
test.equal(grunt.file.read('test/expected/usemin/bar.js').slice(0, -1), grunt.file.read('tmp/usemin/bar.js'));
test.equal(grunt.file.read('test/expected/usemin/all.js').slice(0, -1), grunt.file.read('tmp/usemin/all.js'));
test.equal(grunt.file.read('test/expected/usemin/bar.css'), grunt.file.read('tmp/usemin/bar.css'));
test.done();
},
html5: function(test) {

@@ -40,0 +52,0 @@ test.expect(1);

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