DEV Community

Cover image for Can php file bundle by webpack like html
Al Mamun
Al Mamun

Posted on

Can php file bundle by webpack like html

WebPack can bundle HTML files and output from the src directory to the dist directory.

./src/index.html to ./dist/index.html We know this is a static HTML file, but when I use it in my PHP project, it will need to change the index.html to index.php file. Also, I need to change or customize all of the static content to PHP logic or dynamic content.

My question is if I need to add a new section or edit something in my main HTML file then I will need to change on ./src/index.html file from the src folder, then WebPack will do bundle again and make an ./dis/index.html file to the dist directory. Then again need to change the same process for the PHP files and change in PHP file for dynamic content.

Should I use the PHP file in the src directory and use here PHP functions, logic or something else or dynamic content? Then bundle finally for distribution or final file to dist directory as ./src/index.php file ./dist/index.php

Have any way for use PHP finalize for render/bundle to for distribution?

Top comments (1)

Collapse
 
chuniversiteit profile image
Chun Fei Lung

Assuming that you don’t use a package manager, all you need to do is upload (all of) your PHP files to a PHP-enabled server. That’s it! There’s no bundling step.