Skip to content

feat(@angular/cli): add styles/scripts prefix #5844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/@angular/cli/lib/config/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@
},
"additionalProperties": false
},
"stylesPrefix": {
"type": "string",
"default": "",
"description": "The prefix for output filenames of styles."
},
"scripts": {
"description": "Global scripts to be included in the build.",
"type": "array",
Expand All @@ -174,6 +179,11 @@
},
"additionalProperties": false
},
"scriptsPrefix": {
"type": "string",
"default": "",
"description": "The prefix for output filenames of scripts."
},
"environmentSource":{
"description": "Source file for environment config.",
"type": "string"
Expand Down
4 changes: 2 additions & 2 deletions packages/@angular/cli/models/webpack-configs/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
output: {
path: path.resolve(projectRoot, buildOptions.outputPath),
publicPath: buildOptions.deployUrl,
filename: `[name]${hashFormat.chunk}.bundle.js`,
chunkFilename: `[id]${hashFormat.chunk}.chunk.js`
filename: `${appConfig.scriptsPrefix}[name]${hashFormat.chunk}.bundle.js`,
chunkFilename: `${appConfig.scriptsPrefix}[id]${hashFormat.chunk}.chunk.js`
},
module: {
rules: [
Expand Down
2 changes: 1 addition & 1 deletion packages/@angular/cli/models/webpack-configs/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
plugins: [
// extract global css from js files into own css file
new ExtractTextPlugin({
filename: `[name]${hashFormat.extract}.bundle.css`,
filename: `${appConfig.stylesPrefix}[name]${hashFormat.extract}.bundle.css`,
disable: !buildOptions.extractCss
})
].concat(extraPlugins)
Expand Down