25.06.2018 Views

Full-Stack Vue.js 2 and Laravel 5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CSS<br />

SFCs allow us to add style to a component, helping to better organize our CSS<br />

code. Let's move the CSS rules we created for the image carousel into this new<br />

SFC's style tag: ... ... .imagecarousel<br />

{ height: 100%; margin-top: -12vh; position: relative; display: flex;<br />

align-items: center; justify-content: center; } .image-carousel img { width:<br />

100%; } .image-carousel .controls { position: absolute; width: 100%; display:<br />

flex; justify-content: space-between; } <br />

When the project builds, you should find it still appears the same. The<br />

interesting thing, though, is where the CSS has ended up in the build. If you<br />

check public/css/style.css, you'll find it's not there.<br />

It's actually included in the JavaScript bundle as a string:<br />

Figure 6.9. CSS stored as a string in the JavaScript bundle file To use it, Webpack's bootstrapping code will<br />

inline this CSS string into the head of the document when the app runs:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!