In the case of the esbuild error, just install the dependency, cd assets npm i esbuild, must be above 0.9.6 which is the version that svelte-esbuild needs, in this case it tells you that it cannot find that module because it has not been installed
In the case of elixir I use version 1.12.1, erlang otp 23 and it compiles well for windows 10 and for linux with the ubuntu 18.04 distro
Well, I did npm install upfront. Was kind-of expecting that things needed for the example to work would already be present in package.json so the initial impression was that it might be something deeper. After adding it there the error is in fact gone. Checking further.
For now it was only an educational exercise, with the idea of helping people who wanted to see how to make the integration of the different tools possible.
However, the objective is met because the telemetry error is on the backend side and does not hinder the integration of svelte with phoenix 1.6. If you want to see it running, you could install the aforementioned stack using the asdf plugin that allows you to install different versions without damaging other projects.
Thank you for that. The integration part is exactly what I am/was looking for. Still need to do more thorough checking but on the surface the linux-tailwind works as expected and recompiles Svelte stuff on the fly. And faaast too!
@nikokozak Yes – thank you – every little bit counts! I still haven’t migrated the project in question to 1.6, but this surely will be of help. Thanks for taking time to post information here.
P. S. I noticed you “loosely” based it on Sveltex, which I found not to be up to snuff for some use cases, but that’s another, only “loosely” related story
@silverdr I’d love to hear about that, whenever you have time - at the moment I haven’t really tried stretching Svelte too much, so I haven’t encountered the edge cases I’m sure exist.
Close to successful migration to 1.6.x. What I am also very happy about is that I found:
which allows the project to be both webpack and node.js cancer-free
But… now it’s time to get back to Svelte components, which are used in some places, and that most probably means that “Revenge Of Node_Modules” is coming…
Or maybe somebody thought out a way to get Svelte into Phoenix w/o node?
I understand it might be more tricky than Tailwind, but maybe?
@yendrisrogelio I managed to get basic functionality working now. The issue, which your example repository does not tackle is Svelte components’ internal CSS styles. CSS for component’s markup works only as long as you put tailwind classes directly. IOW words this works:
Sorry for the late reply but I’ve been busy with work. The problem you have is the following, you are trying to apply postcss directives inside the styles of svelte. So that svelte can understand it you need to install svelte-preprocess to your dependencies cd assets && npm i svelte-preprocess, then you must modify your build.js file finally being like this…
Thank you very much for finding time to have a look and respond.
I see. And you are certainly right for this particular case. Yet I should have given a bit more context rather than simply use your demo for the example. What I have in the project is:
a) I already have everything needed to “compile” tailwind stuff, including all @apply directives (PostCSS). This comes from phoenixframework / tailwind,
b) esbuild-svelte buildscript build.js properly processes and extracts Svelte specific stylesheet files.
Therefore in the perfect world phoenixframework / tailwind should be able to compile them and bundle the results in one go, along with everything else it already does. Still I don’t seem to get it to work, at least in a non-smelly way. Any clues?
The problem is that Svelte module’s specific classes don’t make it to the final bundle at all. And that’s understandable because in default configuration both output to the same destination w/o knowing about each other. I can make tailwind output to a different file so that it doesn’t overwrite the one that comes from Svelte but I am having hard time getting the Svelte one processed. I can’t @import that into app.css because “@apply is not supported within nested at-rules like @import”. I can’t pass it as another input to tailwind because
Then you would already have tailwind on all the nested components of the svelte to be used
and maybe this way you avoid svelte class conflicts. I don’t know but maybe that’s how it works for you