Hello there,
it would be really useful to use later emitted output files (assets) for "traverse". Currently you need to run the build twice to accomplish an correctly purify'd build. If you want to keep your build as clean as possible, you might copy some assets and handle everything else by webpack into a clean, empty output folder.
Example:
- Build: If you use a glob on the output path for
paths, there are no files yet. So ~98% of the selectors are rejected.
- Build: the build path has now all the assets, the glob resolves correctly. So ~9% of the selectors are rejected.
Second example:
- Build: If you use the output files statically for
paths, the build will fail as the files cannot be found.
- Build: Just the same, as the files do not get emitted.
The moduleExtensions option does not do the trick, as it rejects only ~3% of the selectors. After treeshaking and all the webpack magic, a lot of stuff is removed in the emitted sources.
I've debugged the plugin and it seems to be really difficult to resolve this issue as PurifyCSS wants paths and it seems impossible to pass sources as string. The assets source can be accessed easily though.
The workarounds that come into my mind are
- temporary files with matching assets source
- listen to
after-emit and give the matching styleExtension assets to PurifyCSS with the output path option set
Both versions would generate files, which is webpacks job after all.
Will this use case - which seems not to be too crazy - ever be supported?
Environment while debugging:
purifycss-webpack: 0.7.0
purify-css: 1.2.5
webpack: 3.10.0
nodeJS: v6.11.2 (x64)
Windows: 7 x64 (6.1.7601)
Regards!