frontend-webpack-boilerplate icon indicating copy to clipboard operation
frontend-webpack-boilerplate copied to clipboard

Support for CSS custom properties and CSS grids

Open dangelion opened this issue 5 years ago • 3 comments

Hi thanks for this boilerplate, awesome! It gets better any time

In this time I’m reading a lot about these 2 modern concepts: CSS custom properties and CSS grids. Well, it results that if working with a little bit IE11 in mind they are ready to be used, now. So I was asking how can add support for them. I mean:

  1. Autoprefixer 9+ at today delivers prefixes and others for supporting CSS Grids in IE (source). It needs to be enabled in Webpack
  2. For CSS custom properties there are some polyfills (link, link) but it could be more interesting this postcss module for Webpack postcss-custom-properties

I'm not a master of Webpack, you can help me to implement those in you boilerplate? Could be interesting to add them as new features? Thanks

dangelion avatar Oct 08 '20 10:10 dangelion

@dangelion

In the latest release v5.0.0 - Webpack 5 Support you can see that autoprefixer version 10 is enabled by default and is respecting the browserslist section in the package.json file. So your build code will be automatically prefixed according to the declared browsers support of your code.

Regarding the CSS custom properties - can you give an example use case of this feature?

pnikolov avatar Oct 27 '20 10:10 pnikolov

@pnikolov thanks. About CSS variables, they're not supported by IE11 but this package will automatically adds fallback, like this:

:root {
  --color: red;
}
 
h1 {
  color: var(--color);
}

compiles to:

:root {
  --color: red;
}
 
h1 {
  color: red;
  color: var(--color);
}

This will let us using as today the CSS variables. What do you think?

dangelion avatar Oct 30 '20 13:10 dangelion

@dangelion We are used to using SASS variables, so that is why the setup template does not have fallback for the CSS variables for IE. I see that postcss-custom-properties can be used to achieve this. I will explore the configuration to evaluate whether it will be hard to add such support.

pnikolov avatar Nov 09 '20 20:11 pnikolov