Is it possible to add properties to the css file created by the angular build?

Asked

Viewed 95 times

4

My angular build generates a stylesheet addition in the index.html as follows:

<link rel="stylesheet" href="style-1.css">
<link rel="stylesheet" href="style-2.css">

You can configure it to add more properties and leave it as the example below?

<link rel="dx-theme" href="style-1.css" data-active="false">
<link rel="dx-theme" href="style-2.css" data-active="false">

my angular.json is like this:

"extractCss": true,
"styles": [
   {input: "src/styles.scss", "bundleName": "style-1"},
   {input: "src/styles2.scss", "bundleName": "style-2"}  
]

1 answer

5


You can customize the entire Angularcli build using the API of Builders, and to make it even easier you can use the ngx-build-plus, which is a community project that lets you directly customize the Webpack configuration file.

For the customization you’re specifically asking for, I think that Issue can help on how to include attributes in the style tag.

  • 1

    Thank you very much, and thank you for your help. I didn’t know ngx-build-plus. Mine was a huge help. By targeting Issue I came to a conclusion. I can add the "inject" property: false to not add the files and include them manually in the html index with the properties I need.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.