Reputation: 3481
I may be a bit confused here but is there an equivelent of
require('../css/mystyles.css')
for the import
command?
i.e:
import '../css/mystyles.css
If no, why not?
Using webpack with vue and hoping to load css files in a manner consistent with the modules
Upvotes: 3
Views: 239
Reputation: 544
From ES6 onwards we can use import keyword
For webpack configuration refer to the official doc here , you will get the exact figure from there
Upvotes: 0
Reputation: 1956
You certainly can import css files with the import
statement like this:
import "../css/mystyles.css.css"
In the webpack.config.js
file you should add a rule to use ‘css-loader’ and ‘style-loader’ for .css files:
module.exports = {
module:{
rules:[
{
test:/\.css$/,
use:['style-loader','css-loader']
}
]
}
Check out this article on Webpack loaders. It's very clear.
Upvotes: 6