Layout Flashcards
How would you add a component to each page in a Nuxt.js app?
Enter the component into an element within the of the default.vue file within the “layouts” directory
How is the “head” information given from a “page” component?
export default { head() { return { title: 'title', meta: [ { hid: 'unique-identifier', name: 'meta-name', content: 'content-description' } ] }; } };
Which directory would you put CSS preprocessor (i.e. SASS or PostCSS) files?
Assets
What does the “Nuxt” element in layouts > default.vue represent?
The current page is inserted as that element
How do you add a component permanently to a default Nuxt.js page?
Add the component to the template within layouts > default.vue
How should partial components of a default vue page be organized?
Create a directory within layouts: layouts > partials > {components}
Where do you define the global CSS stylesheet?
In nuxt.config.js, under the “css” array object, add ‘@/assets/css/main.css’
How is a Google font added to your global stylesheet?
In nuxt.config.js, head > link > { rel: ‘stylesheet’, href: ‘(google_font_href_uri)’ }
In Nuxt.js, how do you account for meta data on dynamic pages?
Use “this” to refer to the specific element that the dynamic page revolves around (i.e. user specific homepage)