CDN vs CLI

So, if you’re working with Vue.js straight from CDN links (no npm, no node.js) - what potential functionality are you missing out on?

You’ll most certainly miss the great Vue SFC.

1 Like

So, I guess I’d better get it ASAP, PDQ, or I’m SOL, right? Ahhh, acronyms.

Not sure if you meant sarcasm, but SFC as an acronym for Single File Components is quite a standard in JS world. Vue’s doc also mentions it.

Thanks, I’ll check it out. I’m probably way off-base here, but I have a single web page that has all my components in the one .js file - so I’m assuming that’s NOT what you’re talking about…

No, thats not what he’s talking about.

Vue’s single file components (SFC) are built in files with the .vue extension, which contain a format like below

<template>
  <div class="myComponent">Component template</div>
</template>
<script>
export default {
   methods: {..},
   data () {...},
   ..etc
}
</script>
<style>
.myComponent {background: green;}
}
</style>

As you can see, a SFC vue file, contains three sections. Template, which holds that components template, script, which exports the Vue component config object, and style, the css styles relevant for that component

this encapsulates all related component details into one file. You cannot use these files in the browser like you di with your one .js file. You need a build enviornment, such as webpack, which “transpiles” the .vue files, into a final JS file, that your html file can then load.

2 Likes

è possível usar props com o CDN ?