Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using regex in exclude option #39

Closed
wants to merge 2 commits into from

Conversation

fbonetti
Copy link

@fbonetti fbonetti commented Jan 25, 2017

Sometimes you need to exclude a file but you don't know the exact filename.

In my case, I have two webpack compilers: one for JS and one for CSS. Each output file has a hash appended to it for the purpose of cache busting.

application_68554c864f233311b88c.js
application_ed9d2efc35d296699f6d.css

When running the JS compiler, I don't want to delete the CSS file generated by a different compiler, but I also don't know the exact name of the CSS file since it contains a hash. This is a where a regex comes in handy:

  new CleanWebpackPlugin(['public'], {
    verbose: true,
    exclude: [/application_.+\.css/]
  })

Edit: fix regex

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 94.059% when pulling bd23432 on fbonetti:master into 1e77c65 on johnagan:master.

4 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 94.059% when pulling bd23432 on fbonetti:master into 1e77c65 on johnagan:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 94.059% when pulling bd23432 on fbonetti:master into 1e77c65 on johnagan:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 94.059% when pulling bd23432 on fbonetti:master into 1e77c65 on johnagan:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 94.059% when pulling bd23432 on fbonetti:master into 1e77c65 on johnagan:master.

@Smolations
Copy link

@fbonetti Are you going to resolve conflicts and push this over the finish line? I would find it extremely helpful...

@arkgast
Copy link

arkgast commented Sep 15, 2017

Yeah @fbonetti great job, I'm waiting for this to be merged.

Copy link
Contributor

@zdanowiczkonrad zdanowiczkonrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@NoCodeMonkey
Copy link

Would love to see this merged, Would you please resolve the conflicts?

@mvirbicianskas
Copy link

any progress on this? would be super awesome to have this functionality!

@micru
Copy link

micru commented Dec 5, 2018

Any reason for not merging this @johnagan? Would be really useful

@chrisblossom chrisblossom mentioned this pull request Feb 25, 2019
crazko pushed a commit to crazko/kalendario that referenced this pull request Mar 4, 2019
## The devDependency [clean-webpack-plugin](https://github.com/johnagan/clean-webpack-plugin) was updated from `1.0.1` to `2.0.0`.
This version is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

---

<details>
<summary>Release Notes for v2.0.0</summary>

<p><a href="https://urls.greenkeeper.io/chrisblossom/clean-webpack-plugin/blob/2.0/README.md">README.md</a></p>
<p>Changes:</p>
<ul>
<li>No configuration is needed for standard usage (cleans webpack's <code>output.path</code>)</li>
<li>By default during webpack's watch mode, only files created by webpack are removed</li>
<li>Because <a href="https://www.npmjs.com/package/del" rel="nofollow">del</a> is used, globbing is supported</li>
<li>Plugin is tested directly via webpack</li>
<li>All supported versions are tested</li>
<li>Windows is tested via <a href="https://www.appveyor.com/" rel="nofollow">appveyor</a> (no mocked tests)</li>
<li>Complete build system including prepublish hooks and git prepush/commit hooks</li>
<li>Written with Typescript</li>
</ul>
<p>Additional notes:</p>
<ul>
<li>Moved to <a href="https://circleci.com/" rel="nofollow">CircleCI</a> because <a href="https://news.ycombinator.com/item?id=18978251" rel="nofollow">Travis CI was sold</a> and <a href="https://news.ycombinator.com/item?id=19218036" rel="nofollow">looks to now be in maintenance mode</a>.</li>
<li>Replaced Coveralls with <a href="https://codecov.io/" rel="nofollow">codecov</a> because automatic build merging works. This is important because of windows/different webpack version testing</li>
</ul>
<p>Please discuss the current API and suggest any changes.</p>
<p>Closes Issues: <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="228815640" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#53" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/53/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/53">#53</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="231858021" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#55" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/55/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/55">#55</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="261623866" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#67" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/67/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/67">#67</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="295742643" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#73" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/73/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/73">#73</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="310004405" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#80" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/80/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/80">#80</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="324754162" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#85" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/85/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/85">#85</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="336239767" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#86" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/86/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/86">#86</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="350539725" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#89" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/89/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/89">#89</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="355469528" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#91" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/91/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/91">#91</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="359168546" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#92" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/92/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/92">#92</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="360576175" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#93" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/93/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/93">#93</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="395851254" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#98" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/98/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/98">#98</a><br>
Closes PRs: <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="203192494" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#39" data-hovercard-type="pull_request" data-hovercard-url="/johnagan/clean-webpack-plugin/pull/39/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/pull/39">#39</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="296175694" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#74" data-hovercard-type="pull_request" data-hovercard-url="/johnagan/clean-webpack-plugin/pull/74/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/pull/74">#74</a></p>
<p>Massive props to <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=1595871" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://urls.greenkeeper.io/chrisblossom">@chrisblossom</a> for working on this and pushing it through.</p>
</details>

<details>
<summary>Commits</summary>
<p>The new version differs by 16 commits.</p>
<ul>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/2e7f7f63699460d827329c04779001a237113f57"><code>2e7f7f6</code></a> <code>2.0.0</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/e90a300fdab0f36e671461bb2ccfbd93f288554c"><code>e90a300</code></a> <code>remove unused babel plugins</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/0ff10f0260aaf4dfd20a0a23850a188b64f856a6"><code>0ff10f0</code></a> <code>windows test fixes</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/d6e2e3821fcca8edd9e68ca4cf57198a82e86bb8"><code>d6e2e38</code></a> <code>use *<em>/</em> instead of ** and update packages</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/e19b19d13f5f9f4bc6495afb4d51773dff8d616a"><code>e19b19d</code></a> <code>reorder option types</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/03d12acc097de106d6b218e5954059beae55a04a"><code>03d12ac</code></a> <code>add protectWebpackAssets option</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/f506dc612bb7c9e946f8fa4f1014db7a74a23a67"><code>f506dc6</code></a> <code>add cleanStaleWebpackAssets option</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/c730f4513f80de9192255cdee4ed831d1d94e199"><code>c730f45</code></a> <code>cleanAfterEveryBuildPatterns should not remove webpack assets</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/6d6b34185ab3bc8ce657d7d46023f5311d4ed612"><code>6d6b341</code></a> <code>initialPatterns renamed to cleanOnceBeforeBuildPatterns, customPatterns renamed to cleanAfterEveryBuildPatterns</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/5e5a51914123e35c07ece8f2c8cadaff9f9f39df"><code>5e5a519</code></a> <code>do not include customPatterns in initialPatterns</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/3830778a378b17d26a40c83310a8b4b04a3dfe62"><code>3830778</code></a> <code>use circleci instead of travis</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/bdb5099c7ea65eca177ca5c8c0306338aa39ab1d"><code>bdb5099</code></a> <code>readme updates</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/d2ac5160892d9ebfe2d1056f5d72edd9b3e217e9"><code>d2ac516</code></a> <code>require dangerouslyAllowCleanPatternsOutsideProject to explicitly set dry to false</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/68893e872f716c4e2efc79746bc114aead323748"><code>68893e8</code></a> <code>allowExternal renamed to dangerouslyAllowCleanPatternsOutsideProject</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/816732823b3178420565fac5cb1b2208b5bdb809"><code>8167328</code></a> <code>by default remove all files once prior to compilation, add allowExternal option, migrate dryRun to dry</code></li>
</ul>
<p>There are 16 commits in total.</p>
<p>See the <a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/compare/277811552e04b705b1ad840365eb493a54f6457e...2e7f7f63699460d827329c04779001a237113f57">full diff</a></p>
</details>

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot 🌴
@chrisblossom
Copy link
Collaborator

Closed in v2.0.0 via #99. See johnagan/clean-webpack-plugin#usage. Please open a new issue if you continue to have problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants