Skip to content

Commit 99bfc02

Browse files
committed
feat(pattern lab): Copy pattern-specific js
1 parent 60ebb6e commit 99bfc02

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

core/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ const patternlab_module = function(config) {
285285
);
286286
//copy non-pattern files like JavaScript
287287
const allJS = patternsToBuild.map(pattern => {
288-
const { name, subdir } = pattern;
288+
const { name, patternPartial, subdir } = pattern;
289289
const {
290290
source: { patterns: sourceDir },
291291
public: { patterns: publicDir },
@@ -295,6 +295,9 @@ const patternlab_module = function(config) {
295295
return copy(src, dest, {
296296
overwrite: true,
297297
filter: ['*.js'],
298+
rename: () => {
299+
return `${patternPartial}.js`;
300+
},
298301
}).on(copy.events.COPY_FILE_COMPLETE, () => {
299302
logger.debug(
300303
`Copied JavaScript files from ${src} to ${dest}`

core/lib/patternlab.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ module.exports = class PatternLab {
380380
allData = _.merge({}, this.data, pattern.jsonFileData);
381381
allData = _.merge({}, allData, allListItems);
382382
allData.cacheBuster = this.cacheBuster;
383+
allData.patternPartial = pattern.patternPartial;
383384

384385
///////////////
385386
// HEADER

0 commit comments

Comments
 (0)