
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-requiregrep
Advanced tools
Grunt task that creates AMD modules by searching for dependencies on source files
Searchs for AMD modules 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-requiregrep can generate:
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 way if you use a bundler like r.js (check grunt-contrib-requirejs) it will include all modules used on your source files automatically.
Install this grunt plugin with: npm install grunt-requiregrep
Then add this line to your grunt.js gruntfile:
grunt.loadNpmTasks('grunt-requiregrep');
Supports the following options:
all.js
)/require\(\s*[\'\"]([^\'\"]*)[\'\"]/gi
console.log('all modules loaded!');
)./*jslint node:true*/
module.exports = function (grunt) {
'use strict';
grunt.loadNpmTasks('grunt-requiregrep'); // load the task
grunt.initConfig({
watch: {
files: '<config:requiregrep.files>',
tasks: 'requiregrep'
},
requiregrep: { // configure the task
all: {
files: {
'scripts/all.js': [
'home.html',
'view/**/*.html'
]
},
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-requiregrep receives a total of 2 weekly downloads. As such, grunt-requiregrep popularity was classified as not popular.
We found that grunt-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.