
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
grunt-contrib-requiregrep
Advanced tools
Grunt task that creates AMD modules by searching for dependencies on source files
Searchs for dependencies required on your source code (eg. template files) and generates an AMD module from it.
Example:
<!-- a/path/to/page.html -->
<!-- require("jquery, widgets, twitter") -->
<!-- another/path/to/anotherpage.html -->
<!-- require("jquery, widgets, fx") -->
Running grunt requiredep
can generate:
// all.js
define(['jquery', 'widgets', 'twitter', 'fx'], function()){
console.log('all modules loaded');
});
Now you can include this new module in your requirejs main config file. This allows you to use a AMD bundler like r.js (check grunt-contrib-requirejs).
Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-contrib-requiregrep
Then add this line to your project's gruntfile:
grunt.loadNpmTasks('grunt-contrib-requiregrep');
Supports the following options:
all.js
)/require\(\s*[\'\"]([^\'\"]*)[\'\"]/gi
console.log('all modules loaded!');
). default: ''/*jslint node:true*/
module.exports = function (grunt) {
'use strict';
grunt.loadNpmTasks('grunt-contrib-requiregrep'); // load the task
grunt.initConfig({
watch: {
files: '<config:requiregrep.files>',
tasks: 'requiregrep'
},
requiregrep: { // configure the task
all: {
files: [ // some example files
'home.html',
'view/**/*.html'
],
dest: 'scripts/all.js',
options: {
onLoad: 'if (window.console){window.console('all modules loaded');}', // run after all dependencies are loaded
}
}
}
});
grunt.registerTask('default', 'watch');
};
FAQs
Grunt task that creates AMD modules by searching for dependencies on source files
The npm package grunt-contrib-requiregrep receives a total of 0 weekly downloads. As such, grunt-contrib-requiregrep popularity was classified as not popular.
We found that grunt-contrib-requiregrep demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.