Skip to content

Commit

Permalink
feat(postcss-plugin.js): update for css-loader@4
Browse files Browse the repository at this point in the history
css-loader@4 introduced a breaking change which meant the use of `~` needs to be relocated from
before the `!!` to after the loader use + `!`

BREAKING CHANGE: this change requires css-loader@4 to work, earlier versions of css-loader should
use previous version

re #46
  • Loading branch information
davidhouweling authored and jantimon committed Aug 19, 2020
1 parent 337f38c commit 5ebaa16
Show file tree
Hide file tree
Showing 7 changed files with 5,683 additions and 4,005 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
language: node_js
node_js:
- 6
- 8
- 10
- 12
before_install:
- stty columns 120
install:
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ This plugin requires:
+ webpack 3.x or higher
+ postcss-loader 2.x or higher
+ node 6 or higher
+ css-loader 2.x or higher
+ css-loader 3.x or higher

## Installation

```
```bash
npm i --save-dev postcss-loader
npm i --save-dev iconfont-webpack-plugin
```
Expand Down Expand Up @@ -84,7 +84,6 @@ const IconfontWebpackPlugin = require('iconfont-webpack-plugin');
resolve: loader.resolve,
fontNamePrefix: 'custom-',
enforcedSvgHeight: 3000,
modules: false,
})
]
}
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

environment:
matrix:
- nodejs_version: 6
- nodejs_version: 10

version: "{build}"
build: off
Expand Down
2 changes: 1 addition & 1 deletion lib/postcss-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function addFontDeclaration (fontName, postCssRoot, enforcedSvgHeight, svgPaths)
const iconFontLoaderPath = path.join(iconFontPluginDirectory, 'lib/loader.js').replace(/\\/g, '/');
const iconFontPlaceholderPath = path.join(iconFontPluginDirectory, 'placeholder.svg').replace(/\\/g, '/');
// Use !! to tell webpack that we don't want any other loader to kick in
const url = '~!!' + iconFontLoaderPath + '?' + JSON.stringify(options) + '!' + iconFontPlaceholderPath;
const url = '!!' + iconFontLoaderPath + '?' + JSON.stringify(options) + '!~' + iconFontPlaceholderPath;
postCssRoot.prepend(postcss.parse(
'@font-face { ' +
'font-family: ' + fontName + '; src:url(\'' + url + '\') format(\'woff\');' +
Expand Down
Loading

0 comments on commit 5ebaa16

Please sign in to comment.