Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular-cli do not bundle the style files in order when using AOT

Tags:

angular

in my .angular-cli.json, the styles property like this:

"styles": [
    "styles.css",
    "../node_modules/bootstrap/dist/css/bootstrap.min.css",
    "adminlte.css",
    "../node_modules/admin-lte/dist/css/skins/skin-yellow-light.min.css"
  ],

I expect these files will bundle in that order, but I got the styles.bundle.css like this:

AdminLTE ...... styles ...... skin-yellow-light ...... bootstrap ......

This lead to my project's style are different from dev mode after I build it. So I wonder why.

like image 978
Gikono Avatar asked Dec 08 '25 22:12

Gikono


1 Answers

I solved this problem by @import all the style files into styles.css, so my angular-cli.json:

"styles": [
    "styles.css"
]

and styles.css:

/* import other style files */
@import "./styles/bootstrap.min.css";
@import './styles/adminlte.css';
@import './styles/skin-yellow-light.min.css';

/* some global styles */
like image 50
Gikono Avatar answered Dec 10 '25 11:12

Gikono



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!