Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Adding overrides to options - allows custom data to be added to bower.js... #5

Merged
merged 2 commits into from

2 participants

@benplum

...on manifest

@bahmutov
Owner

Ben, could you update README.md to show how overrides would be used, please? Then I would be happy to pull

@benplum

Hah! My commit message was auto-corrected to "reedmen" 0- should say "readme."

@bahmutov bahmutov merged commit 3f7baf7 into bahmutov:master
@piranna piranna referenced this pull request
Closed

NPM version is outdated #8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 0 deletions.
  1. +7 −0 README.md
  2. +8 −0 tasks/sync.js
View
7 README.md
@@ -23,6 +23,13 @@ grunt.initConfig({
options: {
// sync specific options
sync: ['author', 'name', 'version', 'private'],
+ // optional: override package values
+ overrides: {
+ main: [
+ '<%= pkg.codename %>.js',
+ '<%= pkg.codename %>.css'
+ ]
+ },
// optional: specify source and destination filenames
from: '../package.json',
to: 'dist/bower.json'
View
8 tasks/sync.js
@@ -40,6 +40,8 @@ module.exports = function (grunt) {
'private',
'license'
];
+ var overridesToSync = configValues.overrides || {};
+
grunt.verbose.writeln('syncing', propertiesToSync, 'from', sourceFilename,
'to', destinationFilename);
@@ -60,6 +62,12 @@ module.exports = function (grunt) {
}
options[propertyToSync] = pkg[propertyToSync] || configValues[propertyToSync];
}, this);
+
+ for (var overrideToSync in overridesToSync) {
+ options[overrideToSync] = overridesToSync[overrideToSync];
+ grunt.verbose.writeln(overrideToSync);
+ }
+
grunt.verbose.writeln('options added to bower', JSON.stringify(options, null, 2));
bower = JSON.stringify(_.extend(bower, options), null, 2);
Something went wrong with that request. Please try again.