![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
grunt-append-sourcemapping
Advanced tools
Grunt task to append a JavaScript sourcemapping URL comment
A Grunt task to append JavaScript sourcemapping URL comments to files. The Google Closure Compiler does not currently append the necessary sourcemapping URL comment to the output it produces, even when you ask it to generate a source map with the create_source_map
option. This Grunt plugin will add that comment for you.
Just install via npm like usual:
npm install grunt-append-sourcemapping
This task assumes that you are using the Closure Compiler to handle JavaScript minification and source map generation. Chances are, you're using the grunt-closure-compiler plugin to do that, so you'll probably have a task in your Grunt file that looks something like this:
grunt.initConfig({
"closure-compiler": {
includeSourcemap: {
js: [
"inputFile.js",
"inputFile2.js"
],
jsOutputFile: "build/lib.min.js",
options: {
create_source_map: "build/lib.min.js.map",
source_map_format: "V3"
}
}
}
});
To append a sourcemapping URL comment at the end of the minified file, you need to tell Grunt to load the new task and then add another section to your config:
grunt.loadNpmTasks("grunt-append-sourcemapping"); // Load the task
grunt.initConfig({
"closure-compiler": {
// Closure compiler configuration
},
"append-sourcemapping": {
main: {
files: {
"build/lib.min.js": "lib.min.js.map"
}
}
}
});
This will append the following comment to the end of lib.min.js (see this jQuery bug ticket for full details on why the wrapping multiline comment is necessary - in short, it's a workaround for an Internet Explorer issue):
/*
//@ sourceMappingURL=lib.min.js.map
*/
You can specify any number of files in the files
property, and as this is a Grunt multitask you can specify different targets too.
FAQs
Grunt task to append a JavaScript sourcemapping URL comment
The npm package grunt-append-sourcemapping receives a total of 28 weekly downloads. As such, grunt-append-sourcemapping popularity was classified as not popular.
We found that grunt-append-sourcemapping 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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.