Reputation: 33938
I have an angular 7 application, everything builds fine. I have a bunch of SASS files, they get complied and included at runtime. All is well.
I am trying to create some static html pages for developer documentation that use the same theme as the compiled one, problem is, in our test environment the css file that gets built/included is a cache-bust version like styles.ac795370d5a11a9e4dc3.css
so i cant hard code a link to my static HTML pages.
Is there a way with angular.json during the build to create another "copy" of the generated css file and drop it in a folder of my choosing?
Upvotes: 0
Views: 449
Reputation: 3774
As far as "another copy" is concerned, it looks like it's not possible within the angular.json
itself.
A simple solution would be to make an npm script that runs the build, then use a postscript to copy the files without the hash.
Eg - package.json
{
...
scripts: [
"build:prod": "ng build --prod",
"postbuild:prod": "cp dist/<your-proj-dir>/styles.*.css dist/<your-proj-dir>/styles.css"
],
...
}
In the cp
command, you can copy it anywhere. I just assumed you would want it in the same directory.
Upvotes: 3