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

Include dev config for emitting certain files to disk. #7

Open
goldenapples opened this issue May 6, 2019 · 3 comments
Open

Include dev config for emitting certain files to disk. #7

goldenapples opened this issue May 6, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@goldenapples
Copy link
Contributor

Certain files in a WordPress editor project, such as any stylesheets registered with add_editor_style() need to be written to disk, even when using the dev server presets in all other cases. Since the configuration for doing this is rather complicated, it would be nice to provide some sugar for enabling this feature without digging too deeply into custom configurations.

Just opening an issue to discuss what the best way to do that might be.

@goldenapples goldenapples added the enhancement New feature or request label May 6, 2019
@goldenapples
Copy link
Contributor Author

I added a module "use" entry and a devServer "writeToDisk" test function to do this in https://github.com/humanmade/platform-site/pull/256. Because the config object that needs to be inserted is so deep in the configuration (it's the third entry in module.rules[1].oneOf[2]) there's not a simple way I can think of to pass this into the presets.development() function.

Still trying to come up with a good way of handling this in webpack-helpers. I do think it'd be really nice to offer some kind of helpers so a project can configure this without having to copy-paste so much code just to modify the module rules.

@kadamwhite
Copy link
Contributor

This is interesting. I thought/expected it could be sorted by bundling the write-file-webpack-plugin and including it in the plugins list for the entry containing the editor styles, but I see why we'd still be missing the mini css extract plugin. I have some ideas (mostly relating to including a presets.production() item in the exported configuration array for the dev server, and using the linked plugin from that entry) but will need to test this out. I'm aiming to release v0.5.0 by Friday so hope to get to this in the next couple days, if you want to talk through it.

@goldenapples
Copy link
Contributor Author

On revisiting this setup for a new project, I'd really like to see this use case supported in the presets bundled. I might be a bit slow working with webpack configs, but each time I've had to add an editor stylesheet it's taken me close to a full day to figure out all the options to get the dev config working properly.

Once I get a working fix for the specific project config I'm working on, I'll be sure to check it in here as a PR.

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

No branches or pull requests

2 participants