-
-
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
Feature request: <script src=""> #507
Comments
Can you explain a bit better what you are trying to achieve please? |
I.e. use an external script file instead of having an inline one On Sun, 15 Mar 2015 19:25 Gianluca Guarini notifications@github.com wrote:
|
E.g.
<example>
<p>This is { sample }</p>
<script src="example.js"></script>
</example>
this.sample = "example"
riot.tag('example', '<p>This is { sample }</p>', function(opts) {
this.sample = "example"
}); |
👍 |
👍 for this too. I currently have TypeScript I might explore how to do this with a custom parser. I'm guessing all you'd need to do to is create a custom parser that 1) identifies a |
Seconding this one. I'm currently working with a sample tag that looks something like this: sample-button
button(onclick="{ sampleTrigger }") Sample
style(scoped).
button {
background-color: red;
}
script(type="coffee").
sampleTrigger = ->
alert("Sample!") Unfortunately, my editor is unable to recognize the contents of the As you might imagine, this makes development pretty tricky - pending an update to the syntax highlighting logic (which is probably non-trivial), it would be useful to be able to keep the code in a separate file. This would also be useful for other preprocessed languages that might not be supported explicitly by the Jade or HTML syntax highlighter in an editor. |
I have resolved the syntax highlighting issue in my own stack (Brackets + Jade, see ForbesLindesay/jade-brackets#20), but I'm still +1 on allowing this feature - both as a workaround for other (possibly less fixable) editors, and for cases where separating the script and markup actually makes sense. EDIT: @bchavez Riot supports TypeScript natively, and you can fairly trivially write your own hook as well. |
I also +1 this idea, for all the reasons @joepie91 mentions and since it is already encouraged to pull in stylesheets in a similar manner. |
@joepie91 Visual Studio won't let you write TypeScript inside an HTML file this is why I found it necessary to write TypeScript inside a stand-alone file. Actually found a decent work-around using a gulp plugin called app.tag.html
gulpfile.js
The |
The #915 dupe made me realize that we should support the charset attribute as well. |
This is a feature I wish there, but I did some tests and there's too many cases to consider when implementing this functionality that can not be met, so it would not be cost effective to implement. In addition, we would be reinventing the wheel, there are many, mature and excelent free tools that address this need, in adition to @bchavez recommendation: brfs with or without browserify, jspreproc, Preprocessor.js, etc. In my tests, let I'm closing this issue, sorry. EDIT: |
@wenbob , @pomutemu , @marcoms , @samuelmesq , @bchavez , @joepie91 , @r4j4h , @Mouvedia , |
Is this only in the pre-compiler to include the source? |
It is only for precompiled tags, i.e the node.js version. EDIT:
I'll update the guide, the cli will support this feature soon. |
I need a "src" attribute like this:
The text was updated successfully, but these errors were encountered: