Skip to content

Commit

Permalink
Add gulp
Browse files Browse the repository at this point in the history
  • Loading branch information
Waren Gonzaga committed Nov 5, 2020
1 parent 1430ef5 commit 7c82f1b
Show file tree
Hide file tree
Showing 13 changed files with 1,630 additions and 112 deletions.
9 changes: 9 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"parserOptions": {
"ecmaVersion": 2017
},

"env": {
"es6": true
}
}
24 changes: 24 additions & 0 deletions demo/assets/css/fork-corner.min.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*!
* Fork Corner - https://github.com/WarenGonzaga/fork-corner#readme
* A modern and global open source fork corner label for your project's landing page.
* Version: 1.0.0-alpha.1
* Github: https://github.com/WarenGonzaga/fork-corner
* Licensed Under The MIT License: http://opensource.org/licenses/MIT
* Copyright (c) 2020 Waren Gonzaga
*
* Facebook: @warengonzagaofficial
* Twitter: @warengonzaga
* Github: @warengonzaga
* Website: warengonzaga.com
*/

/*!
* Main Stylesheet | Fork Corner
* By Waren Gonzaga
*//*!
* Variables Stylesheet | Fork Corner
* By Waren Gonzaga
*//*!
* Base Stylesheet | Fork Corner
* By Waren Gonzaga
*/
5 changes: 2 additions & 3 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Fork Corner</title>
<meta name="description" content="">
<meta name="description" content="A modern and global open source fork corner label for your project's landing page.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
<link rel="stylesheet" href="assets/css/fork-corner.min.css">
</head>
<body>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
<![endif]-->

<script src="" async defer></script>
</body>
</html>
26 changes: 26 additions & 0 deletions fork-corner.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*!
* Fork Corner - https://github.com/WarenGonzaga/fork-corner#readme
* A modern and global open source fork corner label for your project's landing page.
* Version: 1.0.0-alpha.1
* Github: https://github.com/WarenGonzaga/fork-corner
* Licensed Under The MIT License: http://opensource.org/licenses/MIT
* Copyright (c) 2020 Waren Gonzaga
*
* Facebook: @warengonzagaofficial
* Twitter: @warengonzaga
* Github: @warengonzaga
* Website: warengonzaga.com
*/

/*!
* Main Stylesheet | Fork Corner
* By Waren Gonzaga
*/
/*!
* Variables Stylesheet | Fork Corner
* By Waren Gonzaga
*/
/*!
* Base Stylesheet | Fork Corner
* By Waren Gonzaga
*/
24 changes: 24 additions & 0 deletions fork-corner.min.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*!
* Fork Corner - https://github.com/WarenGonzaga/fork-corner#readme
* A modern and global open source fork corner label for your project's landing page.
* Version: 1.0.0-alpha.1
* Github: https://github.com/WarenGonzaga/fork-corner
* Licensed Under The MIT License: http://opensource.org/licenses/MIT
* Copyright (c) 2020 Waren Gonzaga
*
* Facebook: @warengonzagaofficial
* Twitter: @warengonzaga
* Github: @warengonzaga
* Website: warengonzaga.com
*/

/*!
* Main Stylesheet | Fork Corner
* By Waren Gonzaga
*//*!
* Variables Stylesheet | Fork Corner
* By Waren Gonzaga
*//*!
* Base Stylesheet | Fork Corner
* By Waren Gonzaga
*/
27 changes: 27 additions & 0 deletions fork-corner.min.min.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*!
* Fork Corner - https://github.com/WarenGonzaga/fork-corner#readme
* A modern and global open source fork corner label for your project's landing page.
* Version: 1.0.0-alpha.1
* Github: https://github.com/WarenGonzaga/fork-corner
* Licensed Under The MIT License: http://opensource.org/licenses/MIT
* Copyright (c) 2020 Waren Gonzaga
*
* Facebook: @warengonzagaofficial
* Twitter: @warengonzaga
* Github: @warengonzaga
* Website: warengonzaga.com
*/

/*!
* Fork Corner - https://github.com/WarenGonzaga/fork-corner#readme
* A modern and global open source fork corner label for your project's landing page.
* Version: 1.0.0-alpha.1
* Github: https://github.com/WarenGonzaga/fork-corner
* Licensed Under The MIT License: http://opensource.org/licenses/MIT
* Copyright (c) 2020 Waren Gonzaga
*
* Facebook: @warengonzagaofficial
* Twitter: @warengonzaga
* Github: @warengonzaga
* Website: warengonzaga.com
*/
103 changes: 103 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*!
* Fork Corner | Gulpfile
* By Waren Gonzaga
*/

// modules
const {
series,
src,
dest,
watch } = require('gulp'),
sass = require('gulp-sass'),
sassLint = require('gulp-sass-lint'),
header = require('gulp-header'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
fs = require('fs');

const path = {
root: "./",
build: "./*.css",
source: "./source",
demo: "./demo"
};

// open source label
const pkg = JSON.parse(fs.readFileSync('package.json'));
const data = {
banner: [
'/*!',
' * Fork Corner - <%= homepage %>',
' * <%= description %>',
' * Version: <%= version %>',
' * Github: <%= github %>',
' * Licensed Under The MIT License: http://opensource.org/licenses/MIT',
' * Copyright (c) <%= new Date().getFullYear() %> <%= author %>',
' *',
' * Facebook: @warengonzagaofficial',
' * Twitter: @warengonzaga',
' * Github: @warengonzaga',
' * Website: warengonzaga.com',
' */\n\n',
].join('\n'),
};

// setup sass compiler
sass.compiler = require('node-sass');

// link css
function lintCSS() {
return src(path.source+'/*.scss')
.pipe(sassLint())
.pipe(sassLint.format())
.pipe(sassLint.failOnError());
}

// compile css
function compile() {
return src(path.source+'/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(dest(path.root));
}

// minify css
function minify() {
return src(path.build)
.pipe(rename({
suffix: '.min'
}))
.pipe(sass({outputStyle: "compressed"}).on('error', sass.logError))
.pipe(dest(path.root));
}

// add copyright label
function copyright() {
return src(path.build)
.pipe(header(data.banner, pkg))
.pipe(dest(path.root));
}

// clean builds
function cleanBuild() {
return src([path.build, path.demo+'/assets/css/*.css'], {read: false})
.pipe(clean());
}

// develop builds
function devBuild() {
return watch(path.source+'/*.scss', series(
lintCSS, compile, minify, copyright, demo
));
}

// demo
function demo() {
return src('./fork-corner.min.css')
.pipe(dest(path.demo+'/assets/css/'))
}

// gulp process
exports.default = series(lintCSS, compile, minify, copyright, demo);
exports.dev = devBuild;
exports.clean = cleanBuild;
Loading

0 comments on commit 7c82f1b

Please sign in to comment.