Skip to content

Commit

Permalink
codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
anovi committed Dec 5, 2018
1 parent db59fc8 commit b06ae9b
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 112 deletions.
20 changes: 10 additions & 10 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ Generated on <%= moment().format('YYYY-MM-DD') %>

// Get one .styl file and render
gulp.task('build', function () {
return gulp.src(src)
return gulp.src(src)
.pipe(sourcemaps.init())
.pipe(stylus())
.pipe(autoprefixer({
cascade: false
cascade: false
}))
.pipe(headerComment(comment))
.pipe(rename("setka.css"))
Expand All @@ -32,16 +32,16 @@ gulp.task('build', function () {
});

gulp.task('build-mini', function () {
return gulp.src(src)
return gulp.src(src)
.pipe(sourcemaps.init())
.pipe(stylus({}))
.pipe(autoprefixer({
cascade: false
cascade: false
}))
.pipe(csso({
restructure: false,
sourceMap: true,
debug: true
restructure: false,
sourceMap: true,
debug: true
}))
.pipe(headerComment(comment))
.pipe(rename("setka.min.css"))
Expand All @@ -50,15 +50,15 @@ gulp.task('build-mini', function () {
});

gulp.task('zip', () =>
gulp.src('dist/*')
gulp.src('dist/*')
.pipe(zip(`setka-${pkg.version}-dist.zip`))
.pipe(gulp.dest('./'))
);

gulp.task('test', function () {
return gulp.src('./test/test-import.styl')
return gulp.src('./test/test-import.styl')
.pipe(stylus({
use: setka()
use: setka()
}))
.pipe(rename("test-setka.css"))
.pipe(gulp.dest('./dist'));
Expand Down
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var stylus = require('stylus'),
path = require('path');
const stylus = require('stylus');
const path = require('path');

exports = module.exports = plugin;

Expand All @@ -20,7 +20,7 @@ exports.path = __dirname + '/lib';
* @api public
*/
function plugin() {
return function(style){
style.include(__dirname + '/lib');
};
return function(style){
style.include(__dirname + '/lib');
};
}
184 changes: 92 additions & 92 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,106 +3,106 @@ import data from './site/assets/data'

module.exports = {

srcDir: './site',
// rootDir: path.resolve(__dirname, '..'),
srcDir: './site',
// rootDir: path.resolve(__dirname, '..'),

generate: {
dir: 'docs'
},
generate: {
dir: 'docs'
},

router: {
base: process.env.NODE_ENV === 'development' ? '/' : '/setka/',
scrollBehavior: function (to, from, savedPosition) {
// if the returned position is falsy or an empty object,
// will retain current scroll position.
let position = false
router: {
base: process.env.NODE_ENV === 'development' ? '/' : '/setka/',
scrollBehavior: function (to, from, savedPosition) {
// if the returned position is falsy or an empty object,
// will retain current scroll position.
let position = false

if (to.hash && to.path === from.path && document.querySelector(to.hash)) {
position = { selector: to.hash }
return position
}

// if no children detected
if (to.matched.length < 2) {
// scroll to the top of the page
position = { x: 0, y: 0 }
} else if (to.matched.some((r) => r.components.default.options.scrollToTop)) {
// if one of the children has scrollToTop option set to true
position = { x: 0, y: 0 }
}

// savedPosition is only available for popstate navigations (back button)
if (savedPosition) {
position = savedPosition
}

return new Promise(resolve => {
// wait for the out transition to complete (if necessary)
window.$nuxt.$once('triggerScroll', () => {
// coords will be used if no selector is provided,
// or if the selector didn't match any element.
if (to.hash && document.querySelector(to.hash)) {
// scroll to anchor by returning the selector
// position = { selector: to.hash }
position = false
setTimeout(() => {
document.querySelector(to.hash).scrollIntoView()
}, 100)
}
resolve(position)
})
})
}
},
if (to.hash && to.path === from.path && document.querySelector(to.hash)) {
position = { selector: to.hash }
return position
}
// if no children detected
if (to.matched.length < 2) {
// scroll to the top of the page
position = { x: 0, y: 0 }
} else if (to.matched.some((r) => r.components.default.options.scrollToTop)) {
// if one of the children has scrollToTop option set to true
position = { x: 0, y: 0 }
}
// savedPosition is only available for popstate navigations (back button)
if (savedPosition) {
position = savedPosition
}
return new Promise(resolve => {
// wait for the out transition to complete (if necessary)
window.$nuxt.$once('triggerScroll', () => {
// coords will be used if no selector is provided,
// or if the selector didn't match any element.
if (to.hash && document.querySelector(to.hash)) {
// scroll to anchor by returning the selector
// position = { selector: to.hash }
position = false
setTimeout(() => {
document.querySelector(to.hash).scrollIntoView()
}, 100)
}
resolve(position)
})
})
}
},

/*
** Headers of the page
*/
head: {
title: 'Setka CSS Library',
titleTemplate: '%s · Setka',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1, shrink-to-fit=no' },
...meta({
'description': 'Easily control website\'s layout, vertical rythm, responsivness',
'keywords': 'css, css library, layout, responsive, mobile first, bootstrap, stylus, grid, baseline grid',
/*
** Headers of the page
*/
head: {
title: 'Setka CSS Library',
titleTemplate: '%s · Setka',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1, shrink-to-fit=no' },
...meta({
'description': 'Easily control website\'s layout, vertical rythm, responsivness',
'keywords': 'css, css library, layout, responsive, mobile first, bootstrap, stylus, grid, baseline grid',

"og:title": 'Setka CSS library',
"og:type": 'website',
// "og:url": data.url,
"og:image": 'setka-css-share.png',
"og:description": 'Easily control website\'s layout, vertical rythm, responsivness',
})
"og:title": 'Setka CSS library',
"og:type": 'website',
// "og:url": data.url,
"og:image": 'setka-css-share.png',
"og:description": 'Easily control website\'s layout, vertical rythm, responsivness',
})
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: 'favicon.ico' }
]
},
/*
** Global CSS
*/
css: [
{ src: '~/assets/typography.styl', lang: 'stylus' },
{ src: 'highlight.js/styles/github.css' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: 'favicon.ico' }
]
},
/*
** Global CSS
*/
css: [
{ src: '~/assets/typography.styl', lang: 'stylus' },
{ src: 'highlight.js/styles/github.css' }
],
/*
** Customize the progress-bar color
*/
loading: false,
transition: false,
/*
** Customize the progress-bar color
*/
loading: false,
transition: false,

modules: [
'@nuxtjs/style-resources',
'~/modules/generate-after'
],
modules: [
'@nuxtjs/style-resources',
'~/modules/generate-after'
],

styleResources: {
stylus: ['./lib/setka/index.styl']
},
styleResources: {
stylus: ['./lib/setka/index.styl']
},

plugins: [
{ src: '~/plugins/toc', ssr: false}
]
plugins: [
{ src: '~/plugins/toc', ssr: false}
]

}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
"css",
"stylus",
"grid",
"layout"
"baseline grid",
"layout",
"bootstrap"
],
"license": "MIT",
"bugs": {
Expand Down
8 changes: 4 additions & 4 deletions test/test-import.styl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import 'setka'

make-grid()
make-flex()
make-sizing()
make-spacing()
setka-grid()
setka-flex()
setka-sizing()
setka-spacing()

0 comments on commit b06ae9b

Please sign in to comment.