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

grunt-assetpush

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-assetpush - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

.jscs.json

24

Gruntfile.js

@@ -22,4 +22,10 @@ /**

assetpush: {
"tmp/js.html": [ "test/fixtures/*.js" ],
"tmp/css.html": [ "test/fixtures/*.css" ],
"tmp/js.html": [
"test/fixtures/*.js",
"http://example.com/my/script.js?cache=123"
],
"tmp/css.html": [
"test/fixtures/*.css",
"//example.com/my/style.css"
],
"tmp/both.html": [ "test/fixtures/*.css", "test/fixtures/*.js" ]

@@ -29,2 +35,5 @@ },

tests: [ "test/*_test.js" ]
},
jscs: {
main: [ "tasks/*.js", "test/*.js" ]
}

@@ -34,8 +43,9 @@ });

// Dependencies
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-nodeunit");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks( "grunt-contrib-jshint" );
grunt.loadNpmTasks( "grunt-contrib-nodeunit" );
grunt.loadNpmTasks( "grunt-contrib-clean" );
grunt.loadNpmTasks( "grunt-jscs-checker" );
// Actually load the module tasks...
grunt.loadTasks("tasks");
grunt.loadTasks( "tasks" );

@@ -46,3 +56,3 @@ // Clean the tmp folder, run this plugin task, run the unit tests and then clean the tmp folder again.

// By default, just lint JS files and run tests.
grunt.registerTask( "default", [ "jshint", "test" ] );
grunt.registerTask( "default", [ "jshint", "jscs", "test" ] );
};
{
"name": "grunt-assetpush",
"version": "0.1.1",
"version": "0.2.0",
"description": "Grunt task for appending HTML tags for JS/CSS files",

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

"devDependencies": {
"grunt-contrib-jshint": "*",
"grunt-contrib-nodeunit": "*",
"grunt-contrib-clean": "*"
"grunt-contrib-jshint": "~0.6.4",
"grunt-contrib-nodeunit": "~0.2.1",
"grunt-contrib-clean": "~0.5.0",
"grunt-jscs-checker": "~0.2.0"
},

@@ -32,0 +33,0 @@ "peerDependencies": {

@@ -1,15 +0,18 @@

"use strict";
module.exports = function( grunt ) {
"use strict";
var extensions = {
js: /\.js$/i,
css: /\.css$/i
};
var urlRegex = /^(?:https?:)?\/\//i;
function appendHtml( contents ) {
return function( source ) {
return source + contents;
// Files may have an query string; possibly this is a URL.
var extensions = {
js: /\.js(?:\?.*)?$/i,
css: /\.css(?:\?.*)?$/i
};
}
module.exports = function( grunt ) {
function appendHtml( contents ) {
return function( source ) {
return source + contents;
};
}
function task() {

@@ -21,3 +24,17 @@ var options = this.options();

file.src.forEach(function( asset ) {
// Iterate thru the original src, mapping to local files when possible or to URLs, if it's the case
// This is a fix for issue #2
var files = file.orig.src.map(function( f ) {
if ( !urlRegex.test( f ) ) {
console.log(f);
f = grunt.file.expand( f );
}
return f;
});
// Flatten the resulting array
files = grunt.util._.flatten( files );
files.forEach(function( asset ) {
if ( extensions.js.test( asset ) ) {

@@ -46,3 +63,2 @@ contents += "<script src=\"" + asset + "\"></script>";

grunt.registerMultiTask( "assetpush", "Append HTML tags for JS/CSS files", task );
//grunt.registerTask( "assetpush", "Append HTML tags for JS/CSS files", task );
};

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