Complete Vue.js 2 Web Development_ Practical guide to building end-to-end web development solutions with Vue.js 2

(singke) #1
Organize + Automate + Deploy = Webpack Chapter 16

To actually use the Bulma styles, we need to kick in the SASS loader and import the bulma


file. Add the following lines:


<style lang="sass">
@import '~bulma';
</style>

Note how we are specifying the language of our styles in the first line (we are writing SCSS,


but in this case we write it as it is).


If you now try to run your app with the npm run dev command, you will see the Bulma


modal dialog in all its splendor:


How it works...


The official Webpack template contains the configuration rule to never compile files inside


the node_modules directory. This means that authors of web components are encouraged


to distribute an already compiled file because otherwise, users will import raw JavaScript


files (since Webpack won't compile them) in their projects, causing all sorts of errors in
browsers. Personally, I don't think this is good engineering. One problem with this setup is


that since the files you are importing in your project are compiled against one version of


Vue, the component might not work (this actually happened in the past) if you use a newer
version of Vue.

Free download pdf