mod-build 3.6.24 → 3.6.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.6.25
4
+
5
+ - Added new `addAttributes` handlebar helper that allows us to loop through all the attributes defined in the `attributes: {}` object. Use would be `{{{addAttributes objectName 'class'}}}`, with `objectName` being the object that contains `attributes: {}`, and the 'class' being the keys you wish you ignore. If you want to ignore multiple keys, you will add them as follows: `{{{addAttributes objectName 'class' 'id'}}}`. Note: Make sure you use 3 `{{{` so it doesn't automatically escape characters.
6
+
3
7
  ## 3.6.21
4
8
 
5
9
  - `grab-shared-scripts` task code refactoring changes.
@@ -137,6 +137,31 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
137
137
  index++;
138
138
  return index;
139
139
  }
140
+ },
141
+ // Loop to go through and add each attribute defined in the attributes: {} object
142
+ {
143
+ name: 'addAttributes',
144
+ fn: function(obj) {
145
+ var output = '';
146
+ var ignoreKeys = Array.prototype.slice.call(arguments, 1, -1);
147
+
148
+ for (var key in obj.attributes) {
149
+ if (ignoreKeys.indexOf(key) === -1) {
150
+ if (typeof obj.attributes[key] !== 'object') {
151
+ output += key + '="' + obj.attributes[key] + '" ';
152
+ } else if (key === 'data') {
153
+ for (var dataKey in obj.attributes[key]) {
154
+ output += 'data-' + dataKey + '="' + obj.attributes[key][dataKey] + '" ';
155
+ }
156
+ } else if (key === 'aria') {
157
+ for (var ariaKey in obj.attributes[key]) {
158
+ output += 'aria-' + ariaKey + '="' + obj.attributes[key][ariaKey] + '" ';
159
+ }
160
+ }
161
+ }
162
+ }
163
+ return output.trim();
164
+ }
140
165
  }
141
166
  ];
142
167
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "3.6.24",
3
+ "version": "3.6.25",
4
4
  "description": "Share components for S3 sites.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"