-
Notifications
You must be signed in to change notification settings - Fork 147
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
create-elm-webcomponent #336
Comments
Hello again! Happy to hear that you are interested in discussing the setup for making WebComponents. 👍 I might be wrong, but it looks like all of the desired changes could have been done using an override for Webpack config. If we are to push this idea further, then I see two options:
What do you think? |
Neat! I somehow missed this feature, which indeed allows to reconfigure app in a way that produces desired effect to build a webcomponent. At least it looks so from the first glance, I'm going to experiment with it to see what comes up. The only issue I see with this solution is that I couldn't target both app and webcomponent, but I think I could use a workaround with env variable So, I believe building plugin to extend webpack config is a way to go. I'd be thankful if you point me to an example of existing plugin, as I've no idea how to implement that kind of plugin (or maybe some guide / doc). |
It's a recent addition to Create Elm App, which is not very obvious. We are trying to get away from environment variables, so the plan is to make some kind of support for the plugin system, where each plugin modifies Webpack config and enables additional features. Try achieving the desired result with What do you think about that? |
Yep, that works. I will be working on that npm module, then. |
I've pushed my first take on this plugin here: https://github.com/1602/create-elm-app-webcomponent-plugin I hope I get this idea of using plugin right, also looking for suggestion regarding naming of the plugin. Perhaps name should resemble the fact that this is a plugin for create-elm-app for building webcomponent. |
Good stuff! I think it looks really promising! 👍 What do you think about dropping the |
Sure, thanks for the naming suggestion. I've published |
Great news! 🎉 Would you like to have a dedicated section on this in the documentation? |
Yep, that would simplify discovery of this solution for others. Thank you! |
neat. |
I wanted to resume discussion on creation of web-components with create-elm-app.
Desired goal: use zero-configuration setup to build a web-component rather than app.
In order to achieve this goal my immediate development needs I've forked create-elm-app and made a few non-compatible changes, here's a link to diff. Gist of what has changed:
src/index.js
tosrc/custom-element.js
to-string-loader
in order to be able to get css as string, so that it can be inlined in component usingconst css = require('./main.css').toString();
Current workflow looks like this:
src/index.js
as an entry point callingElm.Main.init({ node: document.getElementById('root') })
src/custom-element.js
containing something like this:elm-webcomponent build
(modified version ofelm-app
), which results inbuild/custom-element.js
file containing my app bundled as web-component.I'm looking for direction for further development here, i.e. how would I need to adjust my copy to make these change into mainstream (if there's a need for that). Or maybe there are any better ideas on achieving this goal?
The text was updated successfully, but these errors were encountered: