Skip to content
This repository was archived by the owner on Dec 25, 2018. It is now read-only.
This repository was archived by the owner on Dec 25, 2018. It is now read-only.

Plugin can not handle paths in the output dir #127

@Root-Core

Description

@Root-Core

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:

  1. Build: If you use a glob on the output path for paths, there are no files yet. So ~98% of the selectors are rejected.
  2. Build: the build path has now all the assets, the glob resolves correctly. So ~9% of the selectors are rejected.

Second example:

  1. Build: If you use the output files statically for paths, the build will fail as the files cannot be found.
  2. 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

  1. temporary files with matching assets source
  2. 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions