Skip to content

Commit

Permalink
Maintain custom blocks in templates
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 committed Aug 19, 2018
1 parent 2b4eec3 commit 40a3ae1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,17 @@ function vueThemedStyleLoader(source) {
.map(s => genStyleSection(s, parts.styles, options))
.join('\n');

let output = '';

// Maintain any custom blocks at the top of the file
// This has an assumption now that they are all above <template>
if (_.isArray(parts.customBlocks)) {
output += parts.customBlocks.reduce((acc, b) =>
`${acc}<${b.type}>${b.content}</${b.type}>\n\n`, '');
}

// Reconstruct the Vue Single File Component
const output = `${template}\n${script}\n${styles}`;
output += `${template}\n${script}\n${styles}`;

if (options.debug) {
const filePath = this.resourcePath;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-themed-style-loader",
"version": "0.2.0",
"version": "0.3.0",
"description": "Webpack loader to handle themed style builds of Vue.js applications",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 40a3ae1

Please sign in to comment.