Closed Sigizmund2012 closed 6 years ago
Do you expect Parcel to just copy them over like they are html or really process and execute them as php?
Just copy like html and parse entry points of course :) I have my own local server, that executes php. But optional execution php may be the nice feature.
this is just a matter of registering .php
as an HTMLAsset, right?
the user can then parcel watch index.php
and then serve their dist
with their php server
It is if itβs about just html but if the point is decently supporting it than itβs bit more complex.
Sent with GitHawk
absolutely, but what would decently supporting them be? a php dev server? that seems out of scope
Seems more like a plugin to me, thats why i labeled it help wanted
I don't think a plugin is even needed, I can't think of any special bundling that could be performed for php that wouldn't be already performed by HTMLAsset. correct me if i'm wrong.
The only thing is the php would not execute on the current parcel index.php
.
They can use parcel watch index.php
and serve their dist/
with any php-enabled server, however, and still get the benefits of parcel.
Provided php is a registered HTML extension
Oh, of course, other referenced php files wouldn't be copied without special treatment. i'm a fool
Feel free to test out your approach and do a PR @chee
Hey there, I'm sure I'm not completely getting this, but in my mind I'm thinking Parcel could be great for a simple wordpress build. I read through this thinking it might shed some light but still lost.
I can't seem to wrap my head around on how to get it to work in wordpress build, am I wrong in my thinking that this parcel could be a good solution in this instance?
i have built a plugin that works with very, very simple php programs (ones that only ever include/require files with relative string paths, or dirname(__FILE__) + string
paths) to get an idea of what's involved.
it works very well, but could not handle a real php application.
for a full php application, like a wordpress app, it would need quite a bit more work of ast walk work, translating to dependencies the various ways of including a file in php.
@devanflaherty which part of a wordpress build would you hope to use it for? what job would parcel be doing?
i haven't used a bundler along with a wordpress application, and i'm not sure where it fits in.
I'd also like to know if it's possible to use Parcel with WordPress.
My use case is simple: I just want to split my scripts.js file into multiple files and bundle them together into a script that gets called in a wp_enqueue_script function.
I hate the fact that I have to use Webpack for that.
@ivanjuras of course! you can use your scripts.js
as your entry, so break your scripts.js
up and then do parcel build scripts.js
Closing. If you want to add support for php somehow, feel free to write a plugin!
@ivanjuras I imagine this is way old to reply to you, but just to let you know, you can use gulp for what you want to do with wordpress and it's way easier than webpack for that limited level of bundling needed. I actually skipped gulp to learn webpack because it's supposed to be the future, and it does work, but gulp handles php stuff much easier. If you like, I'd recommend this article on the subject: https://www.sitepoint.com/fast-gulp-wordpress-theme-development-workflow/
I wrote a plugin for that: https://www.npmjs.com/package/parcel-plugin-watch-reload
I wrote a plugin for that: https://www.npmjs.com/package/parcel-plugin-watch-reload
Thanks for this plugin, I was worried I couldn't use PHP with Parcel, so thanks a bunch!
Just now I have project on my local server with php files( form handlers ). If I run Parcel on watch mode, php files not copying to dist folder and browser is not reload if I change those files.
π€ Expected Behavior
I want from Parcel to reload browser( and index.php too ), when I change php files and copy them to dist folder.
π― Current Behavior
The files not copying to dist folder, and browser not reloading, when I change php files.