text! plugin could not load the HTML template during test
See original GitHub issueIt appear when using Karma with Require.js, it cannot load text! plugin. I am getting
Error: /base/app/assets/javascripts/src/client/templates/show.html HTTP status: 404
But if I change the file extension to show.js
, it can be loaded. It appear that it only accept JavaScript file?
Here is the proof-of-concept repo to product this: https://github.com/mech/front_end_demo
Issue Analytics
- State:
- Created 10 years ago
- Comments:21 (1 by maintainers)
Top Results From Across the Web
RequireJS text plugin: cannot load HTML from other domain
I've found the actual problem! This part: config: { text: { useXhr: function (url, protocol, hostname, port) { return true; } } },....
Read more >Using the Text Plugin With RequireJS To Load Remote HTML ...
Ben Nadel demonstrates how to use the Text plugin with RequireJS to load remote HTML templates for client-side DOM augmentation.
Read more >Envato Elements Template Kits - Troubleshooting Common ...
This guide provides general help for common issues you may encounter when using the Template Kit Import or Envato Elements plugins.
Read more >How to Fix the 'Preview Could Not Be Loaded' Error - Elementor
If you receive the error message “the preview could not be loaded”, try the following: · Enable Safe Mode. · Make sure the...
Read more >Handling common HTML and CSS problems - MDN Web Docs
This is a common problem, especially when you need to support old browsers (such as Internet Explorer) or you are using features that...
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
FWIW: I’m using karma 0.12.16 and karma-requirejs 0.2.2 and for me it was just enough to add this line to
karma.conf.js
to successfully load a template via the text plugin and prevend a404
:(files: [{pattern: 'templates/*.html', included: false}])
@ievgenneiman:
text! requirejs can’t load html in Karma solution
<script src="...">
, so this would lead into “unexpected token” error.__html__['some.html']
. This is why Karma servestest.html.js
instead oftest.html
.templates/x.html
, but not include it, so that require.js can fetch it on its own.deps
to load test cases, could meet with unexpected<
error. So use a module to load all test cases.