Javascript link to not exist directory - javascript

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

Related

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?

load multiple file in node js by express

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.

Where should I put these strange files in the file structure for Flask app?

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') }}">

Get Sections of a Document to Match HTML Template

I want let the user import their .docx files and match the sections of .docx file with my HTML page template.
For example;
-Title of imported .docx file should be placed to template's title section,
-Contents of imported .docx file should be placed to template's content section,
-References of imported .docx file should be placed to template's reference section,
-Images of imported .docx file should be placed to template's image section,
and so on.
I have tried mammoth module but It only generates HTML and I cannot find separate sections.
I also think that I can convert the .docx file to .pdf and I used libreoffice-convert module to get .pdf.
Same problem, cannot get sections from the .pdf.
Is there any library in JavaScript or .Net to get sections of .docx or .pdf file?
officegen on npm is good for that :)
Its support docx and pptx :)
Try to check this on npm ^^

How to move tag script in template to a .js file?

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.

Categories