Parcel: Parcel remove quote characters on production build css

Created on 13 Apr 2019  路  2Comments  路  Source: parcel-bundler/parcel

馃悰 bug report


Parcel remove single quote on production build css

馃帥 Configuration (.babelrc, package.json, cli command)


I add a css file like this

    <link href="./index.css" rel="stylesheet">

In index.css, I define a font with some spaces in its name

@font-face {
  font-family: 'Quarz 974';
  src: url('/assets/fonts/quarz974/Quarz 974 Light.woff') format('woff');
}

馃 Expected Behavior


The css stay the same or maybe replace single quotes with double quotes

馃槸 Current Behavior


Quote characters around font name and font url have been gone

@font-face{font-family:Quarz\ 974;src:url(/Quarz 974 Light.0eb3ffef.woff) format("woff")}

馃拋 Possible Solution


I don't know what is going on

馃敠 Context


It just happens when run parcel build
parcel watch and parcel will work normally by generating following css

@font-face {
  font-family: "Quarz 974";
  src: url("/Quarz 974 Light.d8e445c3.woff") format('woff');
}

馃捇 Code Sample


My repo https://github.com/tung-eh/eCommerce

馃實 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.11.2
| Node |8.12.0
| Yarn |1.10.1
| Operating System |MacOS Mojave 10.14

Question

Most helpful comment

@DeMoorJasper Thanks for that, I've resolved this issue by adding cssnano.config.js

module.exports = {
  preset: [
    'default',
    {
      minifyFontValues: {
        removeQuotes: false,
      },
      normalizeUrl: false,
    },
  ],
};

All 2 comments

This is probably a minification by cssnano

Sent with GitHawk

@DeMoorJasper Thanks for that, I've resolved this issue by adding cssnano.config.js

module.exports = {
  preset: [
    'default',
    {
      minifyFontValues: {
        removeQuotes: false,
      },
      normalizeUrl: false,
    },
  ],
};
Was this page helpful?
0 / 5 - 0 ratings