javascript_tag inserted in quoatation marks

#34 · closed · 2 comments

View on GitHub ↗

zithir

Hi, I am just getting started with webpack and your package is a great help. I got it up and running for CSS where it works just fine. However, I am running into problems with JavaScript, when the javascript_tag is always inserted to my templates in double quotation marks and therefore does not work: ``` " <script src="http://localhost:2992/assets/form_dependencies_js.d1bea36e637dc2118771.js"></script> " ``` When I inspect the page source, i can see that the element has been inserted into page differently than other so far manually coded scripts. Compare: ``` <script src="/static/vendors/jquery/dist/jquery.min.js"></script> &lt;script src=&#34;http://localhost:2992/assets/form_styles_js.d917ab71344b86a184c1.js&#34;&gt;&lt;/script&gt; ``` The element is inserted like this regardless of the position in the document. I was using TypeScript as an entry point from which JavaScript was generated, but when I switched directly to JS, the behavior remained the same. When I check the script address on webpack-dev-server, I can normally see the file. When I try to use a `<script src="{{asset_url_for(...)}}">` instead, the src attribute value is "None" on the resulting page. I am using: - webpack 4.26.1 (I had to update the webpack.config.js) - Python 3.7 - flask 1.0.2 - flask_webpack 0.1.0 Any advice would be greatly appreciated, thank you.

Comments

abdul-hamid-achik

you gotta use the |safe filter i believe my friend

nickjj

Hi, Sorry for the long delay. This project is about to get archived and will no longer be supported. A new project is taking its place at: https://github.com/nickjj/flask-static-digest This new project is much easier to use, and will not only work with Webpack but it will work with any (or no) asset build tools. It's completely standalone.