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

grunt-wiredep

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-wiredep - npm Package Compare versions

Comparing version 1.7.1 to 1.8.0

6

package.json
{
"name": "grunt-wiredep",
"description": "Inject your Bower dependencies right into your HTML from Grunt.",
"version": "1.7.1",
"version": "1.8.0",
"homepage": "http://stephenplusplus.github.io/grunt-wiredep",

@@ -29,3 +29,2 @@ "author": {

],
"main": "Gruntfile.js",
"engines": {

@@ -39,5 +38,4 @@ "node": ">=0.8.0",

"dependencies": {
"wiredep": "~1.5.0",
"bower-config": "~0.5.0"
"wiredep": "^1.5.0"
}
}
'use strict';
var bowerConfig = require('bower-config');
var fs = require('fs');
var path = require('path');
function wiredep(grunt) {
grunt.registerMultiTask('wiredep', 'Inject all components in your HTML file.', function () {
grunt.registerMultiTask('wiredep', 'Inject Bower components into your source code.', function () {
this.requiresConfig(['wiredep', this.target, 'src']);
var cwd = this.data.cwd || '.';
var options = this.data;
options.bowerJson = _findBowerJSON(cwd);
options.directory = _findBowerDirectory(cwd);
options.src = grunt.file.expand(options.src);
require('wiredep')(options);
require('wiredep')(this.data);
});
function _findBowerJSON(cwd) {
var bowerJSON;
var config = bowerConfig.read(cwd);
['bower.json', 'component.json'].map(function (configFile) {
return path.join(config.cwd, configFile);
}).forEach(function (configFile) {
if (!bowerJSON && fs.lstatSync(configFile).isFile()) {
bowerJSON = JSON.parse(fs.readFileSync(configFile));
}
});
return bowerJSON;
}
function _findBowerDirectory(cwd) {
var config = bowerConfig.read(cwd);
var directory = path.join(config.cwd, config.directory);
if (!directory || !fs.lstatSync(directory).isDirectory()) {
console.log(
'Cannot find where you keep your Bower packages.' +
'\n' +
'\nWe tried looking for a `.bowerrc` file, but couldn\'t find a custom' +
'\n`directory` property defined. We then tried `bower_components`, but' +
'\nit looks like that doesn\'t exist either. As a last resort, we tried' +
'\nthe pre-1.0 `components` directory, but that also couldn\'t be found.' +
'\n' +
'\nUnfortunately, we can\'t proceed without knowing where the Bower' +
'\npackages you have installed are.' +
'\n'
);
grunt.fail.fatal('No Bower components found.');
}
return directory;
}
}
module.exports = wiredep;
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