Skip to content
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

Issue with compiling non-prettified tags #65

Closed
pavel opened this issue Apr 21, 2016 · 4 comments
Closed

Issue with compiling non-prettified tags #65

pavel opened this issue Apr 21, 2016 · 4 comments
Labels

Comments

@pavel
Copy link

pavel commented Apr 21, 2016

Consider following 2 examples.

Example 1:

<!DOCTYPE html>
<html>
<head>
    <title>Riot test</title>
</head>
<body>
    <test/>

    <template id="test">
        <test>
            <h3>Hi, {name}!</h3>
            <script>
                this.name = "Mike";
            </script>
        </test>
    </template>

    <script src="https://cdn.jsdelivr.net/riot/2.3/riot+compiler.min.js"></script>

    <script>
        riot.compile(test.innerHTML);
        riot.mount("*");
    </script>
</body>
<html>

Output is: Hi, Mike!

Example 2:

<!DOCTYPE html>
<html>
<head>
    <title>Riot test</title>
</head>
<body>
    <test/>

    <template id="test">
        <test><h3>Hi, {name}!</h3><script>this.name = "Mike";</script></test>
    </template>

    <script src="https://cdn.jsdelivr.net/riot/2.3/riot+compiler.min.js"></script>

    <script>
        riot.compile(test.innerHTML);
        riot.mount("*");
    </script>
</body>
<html>

Output is: Hi, !

This is an issue especially when one uses pug, as, by default, it produces non-prettified HTML.

@pavel
Copy link
Author

pavel commented Apr 21, 2016

Also the issue is true for minified pages, for example, a page minified via html-minifier with --minify-js option.

@aMarCruz
Copy link
Contributor

aMarCruz commented Apr 25, 2016

@pavel , this specified in the compiler [guide here]https://github.com/riot/compiler/blob/master/doc/guide.md), in the sections "Indentation" and "The Untagged JavaScript Block".
This is by design because it is the only way we can identify custom riot tags. Also, any minification should happen after the compilation by riot.

I'll close this issue now, feel free to reopen it if you consider it necessary.

@pavel
Copy link
Author

pavel commented Apr 26, 2016

@aMarCruz What I'd like to raise here is:

  1. In Jade (aka Pug) section (though riot compiler uses pretty option, by default) there's no note about using -P(pretty print) flag, if one decides to use CLI, or custom parser (as Pug for example, as right now, you don't support it). I tend to think, that this is better to solve using the next point.
  2. No Caveats/Troubleshoot section, that may clear it out from the start.
  3. Error message does not point in this direction.

Thanks.

@GianlucaGuarini
Copy link
Member

@pavel @aMarCruz probably it's worth to update our doc any pull request is really welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants