-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hayes
committed
Mar 28, 2021
1 parent
bc95fc6
commit 056677d
Showing
9 changed files
with
144 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const {CleanWebpackPlugin} = require('clean-webpack-plugin'); | ||
const path = require('path'); | ||
|
||
const clean = { | ||
plugins: [ | ||
new CleanWebpackPlugin({ | ||
cleanOnceBeforeBuildPatterns: [path.join(process.cwd(), 'dist/**/*')], | ||
}), | ||
], | ||
}; | ||
|
||
module.exports = clean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const CopyWebpackPlugin = require('copy-webpack-plugin'); | ||
const PackerConfig = require('../../config'); | ||
const config = new PackerConfig(require('../../../packer.schema')); | ||
|
||
const copy = { | ||
plugins: [ | ||
new CopyWebpackPlugin({ | ||
patterns: [ | ||
{ | ||
from: config.get('theme.src.assets'), | ||
to: `${config.get('theme.dist.assets')}/[name][ext]`, | ||
}, | ||
{ | ||
from: config.get('theme.src.layout'), | ||
to: config.get('theme.dist.layout'), | ||
}, | ||
{ | ||
from: config.get('theme.src.config'), | ||
to: config.get('theme.dist.config'), | ||
}, | ||
{ | ||
from: config.get('theme.src.locales'), | ||
to: config.get('theme.dist.locales'), | ||
}, | ||
{ | ||
from: config.get('theme.src.snippets'), | ||
to: config.get('theme.dist.snippets'), | ||
}, | ||
{ | ||
from: config.get('theme.src.templates'), | ||
to: config.get('theme.dist.templates'), | ||
}, | ||
{ | ||
from: config.get('theme.src.sections'), | ||
to: config.get('theme.dist.sections'), | ||
}, | ||
], | ||
}), | ||
], | ||
}; | ||
|
||
module.exports = copy; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const isDev = process.env.NODE_ENV !== 'production'; | ||
const PackerConfig = require('../../config'); | ||
const config = new PackerConfig(require('../../../packer.schema')); | ||
const path = require('path'); | ||
|
||
const liquidStyles = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /(css|scss|sass)\.liquid$/, | ||
exclude: config.get('commonExcludes'), | ||
type: 'asset/resource', | ||
generator: { | ||
filename: (pathData) => { | ||
return `${pathData.runtime.split('.')[0]}.${ | ||
path.basename(pathData.filename).split('.')[0] | ||
}.styleLiquid.css.liquid`; | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
if (!isDev) { | ||
liquidStyles.module.rules[0].generator = { | ||
filename: (pathData) => { | ||
return `${pathData.runtime.split('.')[0]}.${ | ||
path.basename(pathData.filename).split('.')[0] | ||
}.styleLiquid.css.liquid`; | ||
}, | ||
}; | ||
} else { | ||
liquidStyles.module.rules[0].generator = { | ||
filename: (pathData) => { | ||
return `layout.${ | ||
path.basename(pathData.filename).split('.')[0] | ||
}.styleLiquid.css.liquid`; | ||
}, | ||
}; | ||
} | ||
|
||
module.exports = liquidStyles; |