question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Full path in js files

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
wonkybreamcommented, Dec 26, 2018

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.

1reaction
lemonsauruscommented, Dec 26, 2018

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found