-
-
Notifications
You must be signed in to change notification settings - Fork 969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop script tags from being evaluated with serverside riot.render #1492
Comments
Have you tried creating an empty script block below the one you want to pass? E. g.: // pseudo code
<support>
<div class="chat-body"></div>
<script src="/assets/js/support.js"></script>
<script></script>
</support> |
+1 |
In theory you should not load third party script in a riot tag. The <my-tag>
<p>{ secretCode }</p>
<script>
import generator from 'path/to/generator'
this.secretCode = generator()
</script>
</my-tag> |
Sure, but it was being used as the main page, no .html files. |
As a workaround I created a basic html template where I did a simple string replace to add the components (tags). Works well enough and doesn't require any additional dependencies but it would be nice if we could create an 'index' tag which supported all of the tags one would find in an html file. |
That's my current approach. On SSR (Server Side Rendering), the getElementByTagName is not available, so this.root.firstChild works for get the head node reference:
|
As well for adding components on a SSR basis on 'index.tag':
|
Well, riot-compiler v2.3.22 could use "defer" to ignore <script src="file.js" defer></script> thoughts? |
@aMarCruz we need to add this info in our doc, can you pull request please when you have time? |
Hey @GianlucaGuarini , I can do that. By 'our doc' you mean: any markdown file in this repository that reference this subject that must be updated or the riotjs.com site content? |
@GianlucaGuarini yes it is needed but... In this doc there's more info about |
fixed in riot 2.3.15, the doc must be updated |
I did not get the Spanglish, sorry. @cognitom, where is the instructions, please? |
Hi, @rodrigorodriguez. Feel free to send PR to riot/compiler ;-) After your update, we'll update riotjs.org, too. |
Docs updated but I am getting 403 while pushing to dev. Tried used a new PR with no success (now closed), waiting for instructions on how to send these updated lines in guide.md to you guys. Is there any docs out there about this? If so I can do that. |
Created the PR at: riot/compiler#54, would you please take a look? |
@rodrigorodriguez done! thanks for your contribution. The use of |
- Fix [riot#1325](riot/riot#1325) : Gulp + Browserify + Babelify + type="es6" error. - Fix [riot#1342](riot/riot#1342), [riot#1636](riot/riot#1636) and request from [dwyl/learn-riot#8](dwyl/learn-riot#8) : Server-Side Rendered Page Fails W3C Check. The new `data-is` attribute is used for scoped styles in addition to `riot-tag` (the later will be removed in compiler v3.x) - The keyword `defer` in `<script src=file>` avoids that the compiler loads the file, preserving the tag - Requested by [riot#1492](riot/riot#1492) : Stop script tags from being evaluated with serverside `riot.render`. It is removed in client-side compilation because browsers will not load scripts through innerHTML. - It has changed the character used to hide expressions during the compilation, maybe this fix [riot#1588](riot/riot#1588) : Syntax Error: Invalid character `\0129` (riot+compiler.min). - Removed the unused parameter with the compiled-time brackets from the call to `riot.tag2`. - Removed support for raw expressions. It is unlikely this feature will be implemented in v2.3.x - Update devDependencies.
- The parsers are moved to its own directory in the node version. The load is on first use. - Fix [riot#1325](riot/riot#1325) : Gulp + Browserify + Babelify + type="es6" error. - Fix [riot#1342](riot/riot#1342), [riot#1636](riot/riot#1636) and request from [dwyl/learn-riot#8](dwyl/learn-riot#8) : Server-Side Rendered Page Fails W3C Check. The new `data-is` attribute is used for scoped styles in addition to `riot-tag` (the later will be removed in compiler v3.x) - The keyword `defer` in `<script src=file>` avoids that the compiler loads the file, preserving the tag - Requested by [riot#1492](riot/riot#1492) : Stop script tags from being evaluated with serverside `riot.render`. It is removed in client-side compilation because browsers will not load scripts through innerHTML. - It has changed the character used to hide expressions during the compilation, maybe this fix [riot#1588](riot/riot#1588) : Syntax Error: Invalid character `\0129` (riot+compiler.min). - The option `debug` inserts newlines between the `riot.tag2` parameters and the call is prefixed with the source filename - Requested by [riot#1646](riot/riot#1646) : Split portions of generated html with newline instead of space - Removed the unused parameter with the compiled-time brackets from the call to `riot.tag2`. - Removed support for raw expressions. It is unlikely this feature will be implemented in v2.3.x - Updated the regex that is used to match tag names, more closer to the HTML5 specs. - Update devDependencies.
I have a component that needs to include third party scripts but when rendering server side it tries to fetch the file instead of just passing it through. Is there a flag I can put on the tag to tell the riot compiler to not fetch?
The text was updated successfully, but these errors were encountered: