Skip to content

Commit

Permalink
v0.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fattenap committed Jul 11, 2020
1 parent 6f3dfdb commit 77bd82f
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 315 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

[UNRELEASED]

[0.7.2]

- Upgrade postcss-typed-css-classes

[0.7.1]

- dependabot > [Changelog](https://github.com/seed-rs/seed-quickstart-webpack/pull/21#issue-429231397)
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "Martin Kavík <[email protected]>",
"name": "seed-quickstart-webpack",
"version": "0.7.1",
"version": "0.7.2",
"repository": "https://github.com/MartinKavik/seed-quickstart-webpack",
"license": "MIT",
"scripts": {
Expand Down Expand Up @@ -34,17 +34,17 @@
"no-emit-webpack-plugin": "^2.0.1",
"postcss-import": "^12.0.1",
"postcss-loader": "^3.0.0",
"postcss-typed-css-classes": "^0.1.6",
"postcss-typed-css-classes": "^0.2.0",
"react-snap": "^1.23.0",
"serve": "^11.3.0",
"serve": "^11.3.2",
"style-loader": "^1.2.1",
"tailwindcss": "^1.4.6",
"text-encoding": "^0.7.0",
"ts-loader": "^7.0.4",
"typescript": "^3.8.3",
"wait-on": "^5.0.0",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0",
"webpackbar": "^4.0.0"
}
Expand Down
29 changes: 12 additions & 17 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
const postcssRustHelpers = require("./scripts/postcss_rust_helpers");

module.exports = ({ file, options, env }) => {
// we want to filter out unused css classes in production mode
// NOTE: options.mode is set in webpack, in the postcss loader ctx
const usedCssClasses =
options.mode === "production"
? postcssRustHelpers.getUsedCssClasses()
: null;

return {
plugins: [
require("postcss-import"),
require("tailwindcss")('tailwind.config.js'),
require("postcss-typed-css-classes")({
output_filepath: "src/generated/css_classes.rs",
generator: "rust",
filter: class_ => {
if (options.mode === "production") {
return usedCssClasses.has(
postcssRustHelpers.escapeClassName(class_)
);
} else {
return true;
purge: options.mode === "production",
output_filepath: "src/generated/css_classes.rs",
content: [
{ path: ['src/**/*.rs'] },
{
path: ['static/index.hbs', 'static/templates/**/*.hbs'],
regex: /class\s*=\s*["'|][^"'|]+["'|]/g,
mapper: className => {
return (className.match(/class\s*=\s*["'|]([^"'|]+)["'|]/)[1]).match(/\S+/g)
},
escape: true
}
}
],
}),
require("autoprefixer")
]
Expand Down
148 changes: 0 additions & 148 deletions scripts/postcss_rust_helpers.js

This file was deleted.

Loading

0 comments on commit 77bd82f

Please sign in to comment.