Skip to content

Conversation

@Blond11516
Copy link
Contributor

@Blond11516 Blond11516 commented Jan 9, 2022

Adds a config option to embed stylesheets by default. Useful for embedding stylesheets by default in prod but not in dev.

Fixes #68

Comment on lines +24 to +29
embed =
Keyword.get(
opts,
:embed_stylesheet,
Application.get_env(:ex_css_modules, :embed_by_default, false)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Think we'd want to have this inside the quote block, so it can retrieve the Application.env value at runtime (to support runtime configs in pre-compiled Mix Release / Distillery apps)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't the point of the embed option to compile the stylesheet into the module?

I'm having trouble seeing how this could work at runtime short of having some sort of external cache like an agent or something 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, you're right, doesn't make much sense indeed. Been working too much on compile time vs runtime config issues lately, my head was somewhere else :P

I'll test this PR in our own app somewhere this week and will get back to you.

Copy link
Collaborator

@sn3p sn3p left a comment

Choose a reason for hiding this comment

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

Tested and confirmed working 💯

@sn3p sn3p merged commit 57113a8 into DefactoSoftware:master Jan 19, 2022
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.

Config option to embed stylesheets by default

3 participants