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

Add a way to know if Encore is running in dev-server env or not, in Twig #623

Closed
Kocal opened this issue Aug 7, 2019 · 4 comments

Comments

@Kocal
Copy link
Contributor

commented Aug 7, 2019

Hi, it's a following of symfony/webpack-encore-bundle/issues/75.

For the Encore part, maybe it can create a new .json file (e.g.: encore.json) which will contains something like this:

{
  "env": "dev-server" 
}

or

{
  "prod": false,
  "dev": false,
  "dev-server": true
}

I'm in favor of the second solution, since we can only have three Encore different envs.

@pscheit

This comment has been minimized.

Copy link

commented Aug 8, 2019

hi! Why do you need this information in twig?

@Kocal

This comment has been minimized.

Copy link
Contributor Author

commented Aug 8, 2019

@Lyrkan

This comment has been minimized.

Copy link
Collaborator

commented Aug 8, 2019

Hey @Kocal,

I'm wondering if that's really the info you are looking for there... in your use case it doesn't fail because you are using the dev server, but because you have full URLs instead of paths.

For instance, having something like Encore.setPublicPath(Encore.isDev() ? '/build' : 'https://<cdn>/') would result in the same issue.

Of course we could also add encore_is_dev() and encore_is_prod() but I have some doubts about how useful it would actually be.

@Lyrkan Lyrkan added the feature label Aug 8, 2019

@Kocal

This comment has been minimized.

Copy link
Contributor Author

commented Aug 8, 2019

Hum, you're right.

Mmmh.. Yes, configuring Encore to use a CDN + using encore_is_dev_server() won't solve any issue.

I think I will go for the first solution I got, iterate on Encore email/email-responsive entries, check if it starts with https:// and yes so I won't inline my CSS.

I'm closing for now. Thanks @Lyrkan :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.