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

Remove template altogether if nothing is retained #440

Closed
Rich-Harris opened this issue Apr 3, 2017 · 2 comments
Closed

Remove template altogether if nothing is retained #440

Rich-Harris opened this issue Apr 3, 2017 · 2 comments

Comments

@Rich-Harris
Copy link
Member

Since certain properties (namespace, components, and types if we do #418) are removed from the generated code, we could get rid of template if it doesn't have any other properties:

<Foo/>

<script>
  import Foo from './Foo.html';

  export default {
    components: { Foo }
  };
</script>

That currently leaves the rather cryptic

var template = (function () {
  return {
    };
}());
@Rich-Harris
Copy link
Member Author

Just want the compiled output to be as clean as possible — a lot of people will make a judgement about whether or not to use Svelte based on the output code they see in the REPL, and having gubbins left lying around like that looks messy. (This actually makes our lives harder, since people don't normally read the entire source code of React or Vue — the nearest equivalent — before committing, but I think it's important for people to see.)

Besides, most people don't use CC — UglifyJS leaves you with var a=function(){return{}}();.

@PaulBGD
Copy link
Member

PaulBGD commented Apr 3, 2017

Yep, I removed my comment for those reasons.

Rich-Harris added a commit that referenced this issue Apr 4, 2017
Remove unnecessary template IIFEs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants