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

ember build -prod fails with broccoli-persistent-filter:CleanCSSFilter error #37

Open
ezpuzz opened this issue Jun 21, 2018 · 14 comments
Open
Labels
Bug Something isn't working

Comments

@ezpuzz
Copy link

ezpuzz commented Jun 21, 2018

Build failed.
Build Error (broccoli-persistent-filter:CleanCSSFilter) in assets/my-app.css

Broken @import declaration of "tailwind.css"

app/styles/app.css

@import 'tailwind.css';

Reproduction Steps:

$ ember -v
ember-cli: 3.1.4
node: 8.11.3
os: darwin x64
$ ember init
$ ember install ember-cli-tailwind
$ ember build --production

Workaround:
Disable minifyCSS in ember-cli-build.js

Desired Behavior:
CSS is run through Clean-CSS after PostCSS when building for production.

@samselikoff samselikoff added the Bug Something isn't working label Jun 21, 2018
@ezpuzz
Copy link
Author

ezpuzz commented Jun 21, 2018

@samselikoff
Copy link
Contributor

Thanks for opening this!

Does your linked commit mean the bug is upstream?

@ezpuzz
Copy link
Author

ezpuzz commented Jun 24, 2018

It looks like upstream Clean-CSS will not be part of ember-cli by default or at least be a separate module. I'm thinking that ember-cli-tailwind is not registered properly as a pre-processor to run before clean-css at this point.

@michaelfich
Copy link

I ran into the same issue this evening after adding ember-cli-tailwind to my Ember 3.2.0 application and trying to run ember deploy production through ember-cli-deploy.

Error: Build Canceled: Broccoli Builder ran into an error with `broccoli-persistent-filter:CleanCSSFilter` plugin. 💥
Broken @import declaration of "tailwind.css"
Error: Broken @import declaration of "tailwind.css"

@knownasilya
Copy link
Contributor

knownasilya commented Jul 23, 2018

Encountered this as well, brand new app.

My workaround, so others don't have to search

let app = new EmberApp(defaults, {
  // TODO: remove when https://github.com/embermap/ember-cli-tailwind/issues/37 is fixed
  minifyCSS: {
    enabled: false
  }
});

@michaelfich
Copy link

I disabled minifyCSS as well though I'd really like to not have to 😄

happycollision added a commit to happycollision/think-system-memorizer that referenced this issue Jul 29, 2018
this should be reverted when embermap/ember-cli-tailwind#37 is fixed
@john-griffin
Copy link

An alternative way to get around this while still maintaining the minified css is to add the following to your package.json (as of ember-cli 3.3.0)

"resolutions": {
    "ember-cli-preprocess-registry": "3.1.0"
}

There might be side effects I'm not aware of by doing this.

From a fresh install production builds do not work without extra config. Is there an agreed upon fix or approach that needs to be worked on either in this addon or upstream?

@samselikoff
Copy link
Contributor

I could use some help figuring out how to best fix this bug.

  • Is Broken @import declaration coming from clean-css? If so what does that mean - paths are misconfigured, or clean-css doesn't know what to do if it sees @import?
  • What does minify-css have to do with this?
  • I don't believe ember-cli-tailwind is a preprocessor so I'm not sure we can register it as one - please correct me if I'm wrong (this is in response to @ezpuzz's comment above)

@samselikoff
Copy link
Contributor

There's an Ember CLI fix for a seemingly related issue, but I tried everything out on Ember CLI 3.4.0-beta.2 (which includes the fix) and now I'm seeing other issues.

I added a comment there, let's see if anyone chimes in. As for now I'm a little lost on how to fix this.

@jkarsrud
Copy link

I had the same issue when building for production. My workaround was to actually link the tailwind.css file in index.html manually;

  <link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css">
+ <link integrity="" rel="stylesheet" href="{{rootURL}}assets/tailwind.css">
  <link integrity="" rel="stylesheet" href="{{rootURL}}assets/frontend.css">

It might not be the best workaround, but it does the job, and the CSS is still minified.

@Benjy1979
Copy link

3.3.0 has the issue, fixed with
minifyCSS: {
enabled: false
}

Is it something that will be addressed in the future?

@championswimmer
Copy link

Still facing the issue. Any better solution than not minifying CSS ?

@samselikoff
Copy link
Contributor

I'd like to move away from Sass and @import and use PostCSS for all the Tailwind inclusion stuff. Would that fix this issue?

@linearza
Copy link

linearza commented Nov 2, 2022

Ran into this now as well., ie:

Build Error (broccoli-persistent-filter:CleanCSSFilter) in assets/vendor.css

Cannot read property '0' of null

By process of elimination I tracked it down to this rule:

.telerik-blazor.k-button-flat {
  // the culprit
  &:after{
    content: none;
  }

  &.other {
    ...
  }
}

When I swap it around, it builds fine:

.telerik-blazor.k-button-flat {
  &.other {
    ...
  }

  // the culprit
  &:after{
    content: none;
  }
}

Worth nothing this isnt a problem during development, only when doing prod builds.
Also were not using ember-cli-tailwind but the following via postcss rather:

  "postcss": "^7.0.39",
  "postcss-focus-visible": "^6.0.1",
  "postcss-import": "^14.0.2",
  "postcss-nested": "^5.0.6",
  "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17"

Dono if that helps, but there ya have it!

EDIT: Seems like the following also resolves it. Clearly something else happening here

.parentClass.subClassOne{}
.parentClass.subClassTwo{}
.parentClass.subClassThree{}

Changing this to

.parentClass{
  &.subClassOne{}
  &.subClassTwo{}
  &.subClassThree{}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants