I find myself struggling trying to use a specific minified CSS file under node_modules
for Milligram in Phoenix Framework using Webpack. First I thought that I need to define a resolve
entry in my webpack.config.js
as described in css-loader
docs.
Then, I've discovered that I can simply use this Webpack notation in my manifest file (app.scss
):
@import '~milligram/dist/milligram.min';
As described in docs:
To import assets from a node_modules path (include resolve.modules) and for alias, prefix it with a ~
Note that if you have other Webpack loaders, it will expand your CSS file in development mode.
3 upvotes·63K views