Skip to content

Instantly share code, notes, and snippets.

@EndangeredMassa
Last active January 9, 2022 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EndangeredMassa/87209850b2506ec021866e39bcd028d8 to your computer and use it in GitHub Desktop.
Save EndangeredMassa/87209850b2506ec021866e39bcd028d8 to your computer and use it in GitHub Desktop.
const IS_DEV = process.env.NODE_ENV === 'development';
let environmentSafelist = [];
if (IS_DEV) {
environmentSafelist.push({
pattern: /.+/, // allow everything
});
}
module.exports = {
content: [
"./index.html",
"./app/**/*.{hbs,js,html}"
],
safelist: [
'active',
...environmentSafelist
]
}
@EndangeredMassa
Copy link
Author

This allow all classes to exist in development. This is useful for changing classes in the browser dev tools and seeing the result live.

@NullVoxPopuli
Copy link

Noice! My work will want this.

Cc @Alonski

@Alonski
Copy link

Alonski commented Jan 7, 2022

This is a great idea!

Saying that, the dangerous thing here is that development and production will now be using a different config.
So we could test things locally and everything works.
Push to production and colors are missing, pixels are off etc.
Of course this can be caught in the PR review but it will be much harder I believe.
We could add this as an env flag though to be passed into ember s if someone wants to use it.

@EndangeredMassa
Copy link
Author

That is a good point. I updated the gist to only change for dev, not test. I like to use Percy for visual diff testing and that would have a reasonable chance of catching issues like this.

@Alonski
Copy link

Alonski commented Jan 7, 2022

Yea I'm with you. Unfortunately, Percy doesn't work for companies that only allow self hosted services because of security reasons.
I wish there was a good self hosted solution.

@EndangeredMassa
Copy link
Author

I built a self-hosted visual diff testing solution at Groupon. It's work, but doable.

I also wish there was a battle-tested open source solution for this.

@knownasilya
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment