Full path in js files
See original GitHub issueI have following problems with JS files loaded into template.
Your loader uses full path which in my case means that path contains site-packages and all that stuff
/lib/python3.6/site-packages/django_simple_bulma/js/bulma-tagsinput.js
Loading css
works fine because it’s done like this css = static("css/bulma.css")
instead of using full path.
By modifying following code to use filename.name
to construct path seems to work in my case.
@register.simple_tag
def bulma():
"""
Build and return all the HTML required to
import bulma and the javascript for all
active extensions.
"""
# Build the html to include the stylesheet
css = static("css/bulma.css")
html = [f'<link rel="stylesheet" href="{css}">']
# Build html to include all the js files required.
for filename in js_folder.iterdir():
js_file = static(f"js/{filename.name}")
extension_name = filename.stem
if extension_name in extensions or extensions == "_all":
html.append(f'{" " * 8}<script type="text/javascript" src="{js_file}"></script>')
return mark_safe("\n".join(html)) # noqa
Now to my actual question. Is there something wrong on my end or is there actually small bug in code?
Thank you very much for your work with this and if there’s anything I can do to help further just say a word.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8 (8 by maintainers)
Top Results From Across the Web
How to get full path of selected file on change of <input type ...
26. Tried your code but its giving me wrong path. my file is in D directory but the value is coming C:\fakepath\test. ·...
Read more >Node.js File Paths
How to interact with file paths and manipulate them in Node.js. ... On Linux and macOS, a path might look like: /users/joe/file.txt while...
Read more >How to get full path of uploaded file in html using JavaScript
JavaScript to get the full path of file: ; type · "hidden" ; name · "MAX_FILE_SIZE" ; value · "30000" ...
Read more >How can I get Absolute path of a file using javascript? - Quora
To get the absolute path of a file you can use the .att() method of jQuery. In the web page a file (...
Read more >FileSystemEntry.fullPath - Web APIs - MDN Web Docs - Mozilla
The read-only fullPath property of the FileSystemEntry interface returns a string specifying the full, absolute path from the file system's ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I created pull request and hopefully it went okay, it’s my first ever. https://github.com/python-discord/django-simple-bulma/pull/10
If there’s anything to modify or fix I’m happy to do it again as a way you’d like it to be done.
@wonkybream that’s great! Thanks so much for contributing to this, and I’m very happy that you’re testing it as well.
If you want to join us over at the Python Discord server, I’d be happy to give you a Contributor role and access to our internal dev channels as thanks for making this contribution. Just poke me, my tag over there is
lemon#0001
.