It makes sense I think to keep using tools from within the Symfony ecosystem as much as possible, as people would likely be more familiar with Encore than Laravel Mix.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 3085759-9-npm-scripts.patch | 3.56 MB | opdavies |
| #9 | 3085759-9-npm-scripts-no-compile.patch | 1.97 KB | opdavies |
Comments
Comment #2
opdaviesI'm still unsure if I want to make this change.
I like the plugin ecosystem for Mix (e.g. PurgeCSS) and it has some functionality like Browsersync that Encore currently doesn't have.
Alternatively, do we go more lightweight and use custom npm scripts with postcss, though in most, if not all, cases something like Mix or Encore needs to be used for JS compilation.
Comment #3
opdaviesComment #4
lhockleyI know I am a bit late to the party here, but I would like to +1 the "lightweight" option.
Here is a minimal Tailwind template I created a while back, which simply uses postcss: https://github.com/xdega/tailwind-postcss
Tailwind is CSS toolkit, therefore I think it is out of scope to let it dictate a JS tooling strategy.
Thoughts?
Comment #5
opdaviesAs you can tell, I'm still undecided on what I want to do with this issue.
I usually use Webpack Encore but I still have some Laravel Mix based themes. I think that most of the time, we need to add some JavaScript into our themes which is why I usually reach for one of those and haven't really thought about using PostCSS or the
tailwind buildcommand, though that might make it easier for people who want to use Encore, Mix, Gulp or something else completely different if they want to.I'll give it some more thought and see what would go into 4.x.
Comment #6
lhockleyIt is probably worth mentioning that, for small amounts of JS, I have found Webpack to be a lightweight option with often minimal amounts of configuration required.
Comment #7
opdaviesIt's been a while since I tried setting up Webpack from scratch, though I know that it can be quite complicated which is why tools like Laravel Mix and Webpack Encore (which are wrappers around Webpack) exist and are used.
Comment #8
lhockleySo. Webpack has actually come a long way.
Version 4+ requires no configuration, with a reasonable default:
https://webpack.js.org/guides/getting-started/
I have projects where I have combined JS and CSS in Webpack, using the PostCSS plugin. But I have ran into issues with Purge not working well. Here is one such project:
https://github.com/xdega/webfresh-v2/blob/master/webpack.config.js
I am thinking you could use two build scripts: Webpack for JS (if needed), and PostCSS for CSS.
The benefit here, would be that if a user doesn't need any custom JS in their theme (maybe using a an external library or something), then they don't even need to run the build script for JS for working with this theme.
Comment #9
opdaviesAttached are some patches that would remove Laravel Mix and move to use npm scripts.
One contains the tooling changes without re-compiling the CSS, just to make it clearer what the changes are.
This makes it more consistent with most of the installation instructions on the Tailwind website and leaves the decision to the user if and they need to compile JavaScipt.
Comment #10
opdaviesComment #12
opdaviesLaravel Mix removed, replaced with npm scripts in 4.x.