Skip to content

Instantly share code, notes, and snippets.

View hibuno's full-sized avatar
🌙
Working at Night

Muhibbudin Suretno hibuno

🌙
Working at Night
View GitHub Profile
@hibuno
hibuno / banner.vue
Created January 22, 2018 00:22
Example banner using SwiperJS on Nuxt
<template>
<div>
<div v-swiper:mySwiper="swiperOption">
<div class="swiper-wrapper">
<div class="swiper-slide" v-for="item in banner" v-bind:key="item.key">
<img :src="item.src" alt="item.src">
</div>
</div>
<div class="swiper-pagination" slot="pagination"></div>
</div>
@hibuno
hibuno / nuxt.config.js
Created January 22, 2018 00:19
Add custom plugin
...
css: [
{ src: '~/assets/scss/navigation.scss', lang: 'scss' }
],
/*
** Custom Plugin
*/
plugins: [
{ src: '~plugins/swiper.js', ssr: false }
@hibuno
hibuno / swiper.js
Created January 22, 2018 00:18
Create instance of swiper plugin
import Vue from 'vue'
import VueAwesomeSwiper from 'vue-awesome-swiper/dist/ssr'
Vue.use(VueAwesomeSwiper)
@hibuno
hibuno / nuxt.config.js
Created January 22, 2018 00:10
Add new code
...
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'stylesheet', type: 'text/css', href: 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.3/css/bootstrap.min.css' },
{ rel: 'stylesheet', type: 'text/css', href: 'https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.7/css/swiper.css' }
]
...a
@hibuno
hibuno / navigation.scss
Created January 21, 2018 23:59
Code for file navigation.scss
.navbar {
background-color: white;
box-shadow: 0px -9px 20px #000000;
.nav {
&-item {
padding: 0 .5rem;
}
&-link {
padding: 1rem;
@hibuno
hibuno / nuxt.config.js
Created January 21, 2018 16:05
Adding function custom loader options at nuxt config
...
function changeLoaderOptions (loaders) {
if (loaders) {
for (const loader of loaders) {
if (loader.loader === 'sass-loader') {
Object.assign(loader.options, {
includePaths: ['./assets'],
// data: '@import "_imports";'
})
}
@hibuno
hibuno / nuxt.config.js
Created January 21, 2018 16:04
Adding function vue loader
...
/*
** Run ESLint on save
*/
extend (config, ctx) {
if (ctx.isDev && ctx.client) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
@hibuno
hibuno / nuxt.config.js
Created January 21, 2018 15:59
Add navigation.scss on nuxt config
...
{ hid: 'title', name: 'title', content: 'Nuxt.js project' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'stylesheet', type: 'text/css', href: 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.3/css/bootstrap.min.css' }
]
},
/*
** Custom SCSS
@hibuno
hibuno / blog.vue
Created January 21, 2018 15:49
Next part of blog.vue file from creating page on Nuxt JS
<template>
<div>
<!-- Navigation -->
<Navigation/>
<!-- Content -->
<div class="container">
<div class="row">
<div class="col-md-9 col-lg-9">
<!-- Content -->
<nuxt/>
@hibuno
hibuno / navigation.vue
Last active January 21, 2018 16:15
Example file of navigation.vue using navbar component from bootstrap 4
<template>
<div>
<nav class="navbar navbar-expand-lg">
<div class="container">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">