{"_id":"@druidvav/grunt-assets-versioning","_rev":"3-11e9090a7c68d14f3bd452f275cabfba","name":"@druidvav/grunt-assets-versioning","dist-tags":{"latest":"1.1.1"},"versions":{"1.1.0":{"name":"@druidvav/grunt-assets-versioning","description":"Versioning static assets with Grunt","version":"1.1.0","homepage":"https://github.com/druidvav/grunt-assets-versioning","author":{"name":"Alexandrine Boissière","email":"theasta@gmail.com"},"repository":{"type":"git","url":"git://github.com/druidvav/grunt-assets-versioning.git"},"bugs":{"url":"https://github.com/druidvav/grunt-assets-versioning/issues"},"licenses":[{"type":"MIT","url":"https://github.com/druidvav/grunt-assets-versioning/blob/master/LICENSE-MIT"}],"main":"Gruntfile.js","engines":{"node":">= 0.10.0"},"scripts":{"test":"grunt test"},"devDependencies":{"grunt":"^1.3","grunt-contrib-clean":"^2.0","grunt-contrib-concat":"^1.0","grunt-contrib-jshint":"^3.1","grunt-contrib-nodeunit":"^4.0","grunt-jsdoc":"^2.4","mock-fs":"^2.3.1"},"peerDependencies":{"grunt":">=1.3.0"},"keywords":["gruntplugin"],"dependencies":{"lodash":"^4.17.21","moment":"^2.9.0","slash":"^1.0.0"},"gitHead":"5e2e62b90e3cc2b635582cce0e6598ce2bc8acab","_id":"@druidvav/grunt-assets-versioning@1.1.0","_nodeVersion":"14.17.6","_npmVersion":"6.14.15","dist":{"integrity":"sha512-k+By13emGXznh5F65hD5sYIzY9XZg8MTchMMOpdsi+KZ/V6CIY1pgtMlP9qUhSHLq5jJDjd8cVHXCaO+h2EO7w==","shasum":"4f30ef6e560a4a1ec5386b41ec80a2613850aa47","tarball":"https://registry.npmjs.org/@druidvav/grunt-assets-versioning/-/grunt-assets-versioning-1.1.0.tgz","fileCount":36,"unpackedSize":68658,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGMr8idEYGOfZQsVXwXglw3eDqjlq0ZNkRfuwQqhuqKCAiBqwYN4n3P4jf5uWpRPIydAAbUToNLI6OOsO75NZFrZ2Q=="}]},"_npmUser":{"name":"druidvav","email":"druidvav@gmail.com"},"directories":{},"maintainers":[{"name":"druidvav","email":"druidvav@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/grunt-assets-versioning_1.1.0_1634391256327_0.6778449003309208"},"_hasShrinkwrap":false},"1.1.1":{"name":"@druidvav/grunt-assets-versioning","description":"Versioning static assets with Grunt","version":"1.1.1","homepage":"https://github.com/druidvav/grunt-assets-versioning","author":{"name":"Alexandrine Boissière","email":"theasta@gmail.com"},"repository":{"type":"git","url":"git://github.com/druidvav/grunt-assets-versioning.git"},"bugs":{"url":"https://github.com/druidvav/grunt-assets-versioning/issues"},"licenses":[{"type":"MIT","url":"https://github.com/druidvav/grunt-assets-versioning/blob/master/LICENSE-MIT"}],"main":"Gruntfile.js","engines":{"node":">= 6.4.0"},"scripts":{"test":"grunt test"},"devDependencies":{"grunt":"^1.3","grunt-contrib-clean":"^2.0","grunt-contrib-concat":"^1.0","grunt-contrib-jshint":"^3.1","grunt-contrib-nodeunit":"^4.0","grunt-jsdoc":"^2.4","mock-fs":"^5.1.1"},"peerDependencies":{"grunt":">=1.3.0"},"keywords":["gruntplugin"],"dependencies":{"lodash":"^4.17.21","moment":"^2.9.0","slash":"^1.0.0"},"gitHead":"5e2e62b90e3cc2b635582cce0e6598ce2bc8acab","_id":"@druidvav/grunt-assets-versioning@1.1.1","_nodeVersion":"14.17.6","_npmVersion":"6.14.15","dist":{"integrity":"sha512-yAIg/4me2iQOBn+KF6b7fXiAqJgdLNpApdtVAY4XTGhggt20tyPmebnQIG+HnY/RxDuzC68swBP9XoXW66/URg==","shasum":"a252280596d06b43a50ff50d5258896e5700c6d2","tarball":"https://registry.npmjs.org/@druidvav/grunt-assets-versioning/-/grunt-assets-versioning-1.1.1.tgz","fileCount":36,"unpackedSize":68651,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzz1QCRA9TVsSAnZWagAACq8P/jJcDvt52enS7cEF39gy\nRPSKgPZeVliSXYogrVKe80m6qZfZuWO+Hlm4pgLxuuhDV69bxlU6OqHXnnN1\nNY5ku2v8K4JIJj08UCSvSO+pklAAnXR1hkCPNu6jBzbNbU+a8veXbLNqhUiV\nrOgkNniqFPkIPm7ICkOYQTHhVPQbvtCPeY9ZDGcEmF5LU9C6TXCoUKJgF5Pv\nKMZ7+dhwhgrba/tqGYnvnbcCSJgyhc10d+YHgaoJ3EcFr1Gi6zdJEq/3HwiD\n5edeMUU1YO0At6H4ncLCOcf5SortP7DH8BM2RSRoZbR+spjLEc3UeFWGAXAt\ncmAYRpAThBLRebKo/2wdo7qtlCjzzmbhFSfY7IL3oyUcImk0XAJy+rrGHF/n\n58np6iJw97HGos7tSBCQIFbrvWf8xvnHAfl7dcwZP2MiN0Kzq1ds1Mf9V80n\nxsrMaV4wbEXZ92/nBWpp5LmM77HtolaIgnJN8IQx8cfxelHIIp+GEcDsl/V5\nHv/WMdxGfXcX7n3Wq1/dTL++iwSfVUhkEIebX1q86BtmsrajXeM7244N8waV\nQtFkaMyZ9t8tY6MMSGmNq+iMP8JEIdt+vhucTmI0osfJN2zCW/f+ccYJYBNC\n3LCQNB4uMqGqzM7N4T+hesJ4d4CFIOat0EvYFjpMusdyk/FbxVqrLdZlL7HZ\nVk7v\r\n=/1//\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCMYArSXKF2Fo+00WhpX86h9IGMslVmHadimO4QS9ne4QIgSZFE4iM5WRUmMWGXsGeunpYeD+uqrlfQXh7acV4SxPY="}]},"_npmUser":{"name":"druidvav","email":"druidvav@gmail.com"},"directories":{},"maintainers":[{"name":"druidvav","email":"druidvav@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/grunt-assets-versioning_1.1.1_1634396309131_0.9072648167939728"},"_hasShrinkwrap":false}},"time":{"created":"2021-10-16T13:34:16.253Z","1.1.0":"2021-10-16T13:34:16.540Z","modified":"2022-04-05T05:42:45.236Z","1.1.1":"2021-10-16T14:58:29.302Z"},"maintainers":[{"name":"druidvav","email":"druidvav@gmail.com"}],"description":"Versioning static assets with Grunt","homepage":"https://github.com/druidvav/grunt-assets-versioning","keywords":["gruntplugin"],"repository":{"type":"git","url":"git://github.com/druidvav/grunt-assets-versioning.git"},"author":{"name":"Alexandrine Boissière","email":"theasta@gmail.com"},"bugs":{"url":"https://github.com/druidvav/grunt-assets-versioning/issues"},"readme":"# grunt-assets-versioning [![Build Status](https://travis-ci.org/theasta/grunt-assets-versioning.svg?branch=master)](https://travis-ci.org/theasta/grunt-assets-versioning) [![NPM version](https://badge.fury.io/js/grunt-assets-versioning.svg)](http://badge.fury.io/js/grunt-assets-versioning)\n[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/theasta/grunt-assets-versioning?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\n\n> Versioning static assets with Grunt\n\n## Getting Started\nThis plugin requires Grunt `~0.4.1`\n\nIf you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:\n\n```shell\nnpm install @druidvav/grunt-assets-versioning --save-dev\n```\n\nOne the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\n\n```js\ngrunt.loadNpmTasks('@druidvav/grunt-assets-versioning');\n```\n\n## The \"assets_versioning\" task\n\n### Overview\nIn your project's Gruntfile, add a section named `assets_versioning` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  assets_versioning: {\n    options: {\n      // Task-specific options go here.\n    },\n    your_target: {\n      options: {\n        tasks: ['uglify:targetTask']\n      }\n    },\n  },\n})\n```\n\nThis task will version the files output by the task uglify:targetTask.\n\n### Options\n\n#### options.tag\nType: `String`\nPossible values: `date`, `hash`\nDefault value: `hash`\n\nShould the revision marker be a md5 hash or a date ?\n\n#### options.hashLength\nType: `Integer`\nDefault value: `8`\n\nIf you choose to version your files using a hash, hashLength let you set how long the hash is going to be.\n\n#### options.dateFormat\nType: `String`\nDefault value: `YYYYMMDDHHmmss`\n\nIf you choose to version your files using a date, you can specify a dateformat. grunt-assets-versioning is using moment.js to format date.\n\n#### options.timezoneOffset\nType: `Number`\nDefault value: `0`\n\nOnly works if you choose to version your files using a date.\nTimezone offset (in hours) to take into account when generating the date version tag. By default, set to 0 (GMT time).\n\n#### options.tasks\nType: `Array` or `Boolean`\nDefault value: `false`\n\nThe tasks you want to run while versioning their destination files.\n\n#### options.versionsMapFile\nType: `String`\nPath to the file in which the versions map will be dumped.\n\nThe assets versioning files outputs a map of versions of all the files processed. Here's how that map looks like:\n```\n[\n  {\n    version: '3d04f375',\n    originalPath: 'path/to/bundle-a.js',\n    versionedPath: 'path/to/bundle-a.3d04f375.js'\n  },\n  {\n    version: '92jdi2j1',\n    originalPath: 'path/to/bundle-b.js',\n    versionedPath: 'path/to/bundle-b.92jdi2j1.js'\n  }\n]\n```\n\nBy default you can retrieve the map of versions by accessing this configuration variable.\n`grunt.config('assets_versioning.yourTask.versionsMap')`\nThe versionsMapFile gives you the possibility to also output that map to a file.\n\n#### options.versionsMapTemplate\nType: `String`\nDefault value: `null`\n\nPath to a lodash template file that is going to be used to generate the versions map file (options.versionsMapFile)\n\nBy default, when no template is indicated, the task will output a json file.\n\nThe lo-dash template may reuse the keys from the version maps (version, originalPath, versionedPath).\nHere's an example of a lo-dash template to generate a php dictionary.\n\n```php\n<?php\n\nclass MyDict\n{\n  public static $myDict = array(\n<% _.forEach(files, function(file) { %>\n    \"<%= file.originalPath %>\" => \"<%= file.versionedPath %>\",\n<% }); %>\n  );\n```\n\n#### options.versionsMapTrimPath\nType: `String`\nThis gives you the possibility to trim the path output in the version map.\n\nFor example, if you set options.versionsMapTrimPath to be 'super/long/path/to/', instead of getting this map:\n\n```\n[\n  {\n    version: '3d04f375',\n    originalPath: 'super/long/path/to/bundle-a.js',\n    versionedPath: 'super/long/path/to/bundle_a.3d04f375.js'\n  },\n  {\n    version: '92jdi2j1',\n    originalPath: 'super/long/path/to/bundle-b.js',\n    versionedPath: 'super/long/path/to/bundle-b.92jdi2j1.js'\n  }\n]\n```\n\nyou will get this one:\n\n\n```\n[\n  {\n    version: '3d04f375',\n    originalPath: 'bundle-a.js',\n    versionedPath: 'bundle_a.3d04f375.js'\n  },\n  {\n    version: '92jdi2j1',\n    originalPath: 'bundle-b.js',\n    versionedPath: 'bundle-b.92jdi2j1.js'\n  }\n]\n```\n\n#### options.skipExisting\nType: `Boolean` or `Array`\nDefault value: `false`\n\nIf true, will skip the task if the destination file already exists.\nIf type Array, will skip the task if the destination file, once versioned, is listed in the array.\n\n#### options.post\nType: `Boolean`\nDefault value: `false`\n\nBy default, the grunt-assets-versioning task uses the content of the source files to create a version hash.\nCombined with the skipExisting option, it allows to speed up the deployment process by skipping tasks that would output an already-existing destination file.\n\nIf ever you're trying to version a task that doesn't expose all its source files but only an entry point (less, requirejs), you should set the post options to true.\n\n```\nless: {\n  production: {\n    files: {\n      \"path/to/result.css\": \"path/to/source.less\"\n    }\n  }\n},\nassets_versioning: {\n  css: {\n    options: {\n      post: true,\n      tasks: [\"less:production\"]\n    }\n  }\n}\n```\n\n### Usage Examples\n\n#### Versioning using a hash\nIn this example, dest.bundle.js is going to be versioned with a hash. All sources files are going to be hashed and those hashes are also going to be hashed. The generated result should be\ndest/bundle.2j4h2kds.js\n\n```js\ngrunt.initConfig({\n  assets_versioning: {\n    options: {\n      tag: 'hash',\n      hashLength: 6,\n    },\n    files: {\n      'dest/bundle.js': ['src/file1.js', 'src/file2.js'],\n    },\n  },\n})\n```\n\n#### Versioning using a date\nIn this example, dest.bundle.js is going to be versioned with a date, using\nthe default format YYYYMMDDHHmmss. The newest modification dates of all src files is\ngoing to be used to create this timestamp. The generated result should be\ndest/bundle.20130413004500.js\n\n```js\ngrunt.initConfig({\n  assets_versioning: {\n    options: {\n      tag: 'date',\n    },\n    files: {\n      'dest/bundle.js': ['src/file1.js', 'src/file2.js'],\n    },\n  },\n})\n```\n","readmeFilename":"README.md"}