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?
Related
how to load html file along with css file and javascrip file in node js by express?
when I enter localhost:8080\about, load the about us page that contain html,css and js.
for that in your main express js file, you are going to want to add this line at the top of the file
app.use(express.static(__dirname + '/pathToStaticFiles'));
pathToStaticFiles will be the path to your static file, (usually called assets or public). Then all your html files will read from that directory so if your file path for the css file is ./static/css/style.css the html file will call from ./css/style.css. Hope this helped.
I have a js file which contains some data, in the public directory. And I want to change them even after the building. And I don't like to build every time I change that file. How can I import that data.js file without getting "Relative imports outside of src/ are not supported." error.
The project was created using create-react-app.
You need to include it using a script tag in the index.html file in your public folder.
So I downloaded a template for a website, with the aim to use it in my Flask app. I know the basic file structure of Flask app is this:
-app
app.py
-static
-images
-image files
-style
-css files
-templates
-html files
But when I opened the folder of the template code, I found all these strange files and I couldn't decide where to put them.
The original files:
So I put the css, fonts, images, js folders into the static folder and left the rest of the files in the templates folder along with index.html (ignore index - Copy.html, that is a copy I made of the original index.html file), updated the paths of css and js files inside the HTML document and executed app.py.
The file ran but most of the text of index.html was not loading and only one image was being displayed. I checked the logs in the command line terminal and discovered that most of the css was not even getting called.
What am I doing wrong? How should I arrange these files?
In your html file you should connect styles in this way:
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/style.css') }}">
I want to use my javascript file that is in /js directory but I cannot do it.
My file is at htdocs\ElasticSearch\js but the html file points the file to htdocs\ElasticSearch\js\src\main\scripts which doesn't exist
my HTML file here
html code
I want the HTML file to link to htdocs\ElasticSearch\js
I want to move tag script content in template to a .js file(e.g. in this way, I can use JSHint, whatever) and put it into template directory.
I found the document that said it can treat .js file as a static file, so I must run python manager.py collectstatic every time when I deploy my .js file to server(because I need debug my js code). That is very trivial.
I want to put my .js file and template file which including the .js together, so how to do it?
You can use the --link option in collectstatic to symlink your files rather than copying. That means you only need to run collectstatic again when you are adding a completely new static file, since updates to existing ones will be automatically seen via the symlink.
I add this line in my template file (e.g. template file is path/to/foo.html):
<script>{% include "path/to/send_bill.js" %}</script>
so it include .js file and add into template .html file as origin, but I can modify my .js file separately!
I don't know is there some side effect?
#Daniel Roseman your solution is very graceful.