Include 'normalize-scss' in Vue CLI 3
10,725
Solution 1
I figured it out. You need to put the normalize()
after you import it, in your main.scss file. So:
@import 'normalize-scss';
@include normalize();
Solution 2
after installing it with npm import it at the top of main.js file:
import "normalize.css"
Solution 3
If you have a main/global scss file you already use:
- Add normalize.css (any of these) to your project:
yarn add normalize.css
(or npm) - in your main.scss for example:
@import '~normalize.css';
Note the ~
for ambiguity as cli docs say: https://cli.vuejs.org/guide/css.html#referencing-assets
Author by
Modermo
Updated on June 14, 2022Comments
-
Modermo almost 2 years
Just added the package
normalize-scss
to my new Vue project, but none of the styles are being applied... I've tried both:@import 'normalize-scss'
in mystyles.scss
import 'normalize-scss'
in mymain.js
pageAm I doing something wrong? The package is clearly there because the app runs, but it doesn't actually apply any css rules.
-
Илья Зеленько over 5 yearsIt seems there is not so simple: github.com/JohnAlbin/normalize-scss#how-to-use-it
-
-
Modermo over 5 yearsThis works for stylesheets that I've added manually, but not for this package.
-
alliuca over 4 yearsIn my case I had to use
import "~normalize.css"