Skip to content

Commit e2cd9f1

Browse files
Merge pull request #1 from openapidotvn/development
Release vbase-html v1.0
2 parents 08dc3f5 + 8bff037 commit e2cd9f1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+9392
-2
lines changed

.babelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"presets": [
3+
"env"
4+
]
5+
}

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
end_of_line = lf
10+
11+
# editorconfig-tools is unable to ignore longs strings or urls
12+
max_line_length = null

.eslintrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "airbnb-base",
3+
"env": {
4+
"browser": true,
5+
"commonjs": true,
6+
"es6": true,
7+
"jquery": true
8+
},
9+
"rules": {
10+
"no-console": 0
11+
}
12+
}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/node_modules/
2+
/bower_components/
3+
/app/
4+
/yarn-error.log

.sass-lint.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# sass-lint config generated by make-sass-lint-config v0.1.2
2+
#
3+
# The following scss-lint Linters are not yet supported by sass-lint:
4+
# PrivateNamingConvention
5+
6+
files:
7+
include: '**/*.s+(a|c)ss'
8+
options:
9+
formatter: stylish
10+
merge-default-rules: false
11+
rules:
12+
bem-depth: 1
13+
border-zero:
14+
- 1
15+
- convention: zero
16+
brace-style:
17+
- 1
18+
- allow-single-line: false
19+
class-name-format:
20+
- 1
21+
- convention: ^(?!js-).*
22+
convention-explanation: should not be written in the form js-*
23+
extends-before-declarations: 0
24+
extends-before-mixins: 0
25+
function-name-format: 1
26+
id-name-format:
27+
- 1
28+
- convention: hyphenatedbem
29+
leading-zero: 0
30+
mixin-name-format: 1
31+
mixins-before-declarations: 0
32+
no-extends: 1
33+
no-qualifying-elements: 0
34+
placeholder-name-format:
35+
- 1
36+
- convention: hyphenatedbem
37+
property-sort-order: 0
38+
quotes:
39+
- 1
40+
- style: double
41+
variable-name-format: 1

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
language: node_js
2+
node_js:
3+
- "6"
4+
script:
5+
- npm run setup
6+
- npm run build

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
1-
# vbase-html
2-
vBase HTML
1+
# [vBase HTML](https://github.com/openapidotvn/vbase-html)
2+
3+
A front-end boilerplate for converting PSD/Sketch to HTML/CSS JavaScript focused on performance and best practices.
4+
5+
[![Build Status](https://travis-ci.org/openapidotvn/vbase-html.svg?branch=master)](https://travis-ci.org/openapidotvn/vbase-html)
6+
7+
## Quick start
8+
9+
1. Download the latest stable release from
10+
[here](https://github.com/openapidotvn/vbase-html/releases) or clone this repo using `git clone --depth=1 https://github.com/openapidotvn/vbase-html.git`
11+
2. Run `yarn run setup` or `npm run setup` to install dependencies
12+
3. Run `yarn run start` or `npm run start` and go to `http://localhost:8000`
13+
14+
## License
15+
16+
The code is available under the [MIT license](LICENSE.md).

bower.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "vbase-html",
3+
"description": "vHTML Boilerplate",
4+
"main": "index.js",
5+
"authors": [
6+
"Hung Pham Do"
7+
],
8+
"license": "MIT",
9+
"homepage": "",
10+
"ignore": [
11+
"**/.*",
12+
"node_modules",
13+
"bower_components"
14+
],
15+
"dependencies": {
16+
"jquery": "2.2.4",
17+
"bootstrap": "3.3.7",
18+
"bootstrap-sass": "3.3.7",
19+
"animate-sass": "^0.8.2"
20+
}
21+
}

gulpfile.js

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
const gulp = require('gulp');
2+
const gulpLoadPlugins = require('gulp-load-plugins');
3+
const browserSync = require('browser-sync').create();
4+
const runSequence = require('run-sequence');
5+
const packageInfo = require('./package.json');
6+
const wiredep = require('wiredep').stream;
7+
8+
const $ = gulpLoadPlugins();
9+
const reload = browserSync.reload;
10+
11+
const banner = [
12+
'/*!',
13+
' * <%= package.name %>',
14+
' * <%= package.title %>',
15+
' * <%= package.url %>',
16+
' * @author <%= package.author %>',
17+
' * @version <%= package.version %>',
18+
' * Copyright ' + new Date().getFullYear() + '. <%= package.license %> licensed.',
19+
' */',
20+
].join('\n');
21+
22+
gulp.task('images', () => {
23+
return gulp.src('src/images/**/*')
24+
.pipe($.cache($.imagemin()))
25+
.pipe(gulp.dest('app/assets/images'));
26+
});
27+
28+
gulp.task('fonts', () => {
29+
return gulp.src(require('main-bower-files')('**/*.{eot,svg,ttf,woff,woff2}', function (err) { })
30+
.concat('src/fonts/**/*'))
31+
.pipe(gulp.dest('app/assets/fonts'));
32+
});
33+
34+
gulp.task('icons', () => {
35+
return gulp.src('src/icons/**/*.svg')
36+
.pipe($.iconfont({
37+
fontHeight: 1001,
38+
normalize: true,
39+
fontName: packageInfo.icons.fontName, // required
40+
prependUnicode: true, // recommended option
41+
formats: ['ttf', 'eot', 'woff', 'woff2', 'svg'], // default, 'woff2' and 'svg' are available
42+
timestamp: Math.round(Date.now() / 1000), // recommended to get consistent builds when watching files
43+
}))
44+
.on('glyphs', function (glyphs, options) {
45+
const opts = {
46+
glyphs: glyphs.map(function (glyph) {
47+
return { name: glyph.name, codepoint: glyph.unicode[0].charCodeAt(0) };
48+
}),
49+
fontName: packageInfo.icons.fontName,
50+
className: packageInfo.icons.className
51+
};
52+
gulp.src('src/templates/helpers/icons-scss.njk')
53+
.pipe($.consolidate('lodash', opts))
54+
.pipe($.rename('_icons.scss'))
55+
.pipe(gulp.dest('src/styles/helpers'));
56+
57+
gulp.src('src/templates/helpers/icons.njk')
58+
.pipe($.consolidate('lodash', opts))
59+
.pipe(gulp.dest('src/templates'));
60+
})
61+
.pipe(gulp.dest('src/fonts'));
62+
});
63+
64+
65+
gulp.task('styles', () => {
66+
return gulp.src('src/styles/*.scss')
67+
.pipe($.plumber())
68+
.pipe($.sass.sync({ outputStyle: 'expanded', precision: 10, includePaths: ['.'] }).on('error', $.sass.logError))
69+
.pipe($.autoprefixer({ browsers: ['> 0%'] }))
70+
.pipe($.header(banner, { package: packageInfo }))
71+
.pipe(gulp.dest('app/assets/styles'))
72+
.pipe(reload({
73+
stream: true
74+
}));
75+
});
76+
77+
gulp.task('scripts', () => {
78+
return gulp.src('src/scripts/*.js')
79+
.pipe($.plumber())
80+
.pipe($.babel())
81+
.pipe($.header(banner, { package: packageInfo }))
82+
.pipe(gulp.dest('app/assets/scripts'))
83+
.pipe(browserSync.stream());
84+
});
85+
86+
gulp.task('wiredep', () => {
87+
return gulp.src('src/templates/layouts/*.njk')
88+
.pipe($.plumber())
89+
.pipe(wiredep({
90+
exclude: [''],
91+
ignorePath: /^(\.\.\/)*\.\./,
92+
fileTypes: {
93+
njk: {
94+
block: /(([ \t]*)<!--\s*bower:*(\S*)\s*-->)(\n|\r|.)*?(<!--\s*endbower\s*-->)/gi,
95+
detect: {
96+
js: /<script.*src=['"]([^'"]+)/gi,
97+
css: /<link.*href=['"]([^'"]+)/gi
98+
},
99+
replace: {
100+
js: '<script src="{{filePath}}"></script>',
101+
css: '<link rel="stylesheet" href="{{filePath}}" />'
102+
}
103+
}
104+
}
105+
}))
106+
.pipe(gulp.dest('src/templates/layouts'));
107+
});
108+
109+
gulp.task('views', () => {
110+
return gulp.src('src/templates/*.njk')
111+
.pipe($.plumber())
112+
.pipe($.nunjucksRender({ path: 'src/templates' }))
113+
.pipe(gulp.dest('app'))
114+
.pipe(browserSync.stream());
115+
});
116+
117+
gulp.task('useref', ['views', 'styles', 'scripts'], () => {
118+
return gulp.src(['app/*.html'])
119+
.pipe($.useref({
120+
searchPath: ['./app', './', 'bower_components']
121+
}))
122+
.pipe($.if(/\.js$/, $.uglify({
123+
})))
124+
.pipe($.if(/\.css$/, $.cssnano({
125+
safe: true,
126+
autoprefixer: false
127+
})))
128+
.pipe(gulp.dest('dist'));
129+
});
130+
131+
gulp.task('build', () => {
132+
runSequence(['wiredep'], [
133+
'useref', 'images', 'fonts'
134+
], () => {
135+
return gulp.src([
136+
'app/**/*',
137+
'!app/*.html',
138+
'!app/**/*.js',
139+
'!app/**/*.css'
140+
]).pipe($.size({
141+
title: 'build',
142+
gzip: true
143+
})).pipe(gulp.dest('dist'));
144+
});
145+
});
146+
147+
gulp.task('serve', () => {
148+
runSequence(['wiredep'], [
149+
'views', 'styles', 'scripts', 'images', 'icons', 'fonts'
150+
], () => {
151+
browserSync.init({
152+
notify: false,
153+
port: 8000,
154+
server: {
155+
baseDir: ['app', './']
156+
},
157+
routes: {
158+
'/bower_components': 'bower_components'
159+
}
160+
});
161+
});
162+
163+
164+
gulp.watch([
165+
'src/images/**/*'
166+
]).on('change', reload);
167+
168+
gulp.watch('src/**/*.{html,njk}', ['views']);
169+
gulp.watch('src/styles/**/*.scss', ['styles']);
170+
gulp.watch('src/scripts/**/*.js', ['scripts']);
171+
gulp.watch('src/fonts/**/*', ['fonts']);
172+
gulp.watch('src/icons/**/*', ['icons']);
173+
gulp.watch('src/images/**/*', ['images']);
174+
gulp.watch('bower.json', ['wiredep', 'fonts']);
175+
});
176+
177+
gulp.task('default', ['serve']);

package.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"name": "vbase-html",
3+
"version": "1.0.0",
4+
"description": "vBase HTML",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"setup": "npm install & bower install",
9+
"prestart": "npm run clean",
10+
"prebuild": "npm run clean",
11+
"start": "gulp serve",
12+
"clean": "rimraf ./dist && rimraf ./app",
13+
"build": "gulp build"
14+
},
15+
"repository": {
16+
"type": "git",
17+
"url": "git+https://openapidotvn@github.com/openapidotvn/vbase-html.git"
18+
},
19+
"keywords": [],
20+
"author": "Hung Pham Do",
21+
"license": "MIT",
22+
"bugs": {
23+
"url": "https://github.com/openapidotvn/vbase-html/issues"
24+
},
25+
"homepage": "https://github.com/openapidotvn/vbase-html#README",
26+
"devDependencies": {
27+
"babel-cli": "^6.24.1",
28+
"babel-preset-env": "^1.6.1",
29+
"bower": "^1.8.2",
30+
"browser-sync": "^2.18.8",
31+
"eslint": "^4.19.1",
32+
"eslint-config-airbnb-base": "^12.1.0",
33+
"eslint-plugin-import": "^2.11.0",
34+
"gulp": "^3.9.1",
35+
"gulp-autoprefixer": "^3.1.1",
36+
"gulp-babel": "^6.1.2",
37+
"gulp-cache": "^1.0.2",
38+
"gulp-concat": "^2.6.1",
39+
"gulp-consolidate": "^0.2.0",
40+
"gulp-cssnano": "^2.1.2",
41+
"gulp-filter": "^5.1.0",
42+
"gulp-header": "^1.8.9",
43+
"gulp-iconfont": "^9.1.0",
44+
"gulp-if": "^2.0.2",
45+
"gulp-imagemin": "^4.1.0",
46+
"gulp-load-plugins": "^1.5.0",
47+
"gulp-nunjucks-render": "^2.0.0",
48+
"gulp-plumber": "^1.1.0",
49+
"gulp-rename": "^1.2.2",
50+
"gulp-rimraf": "^0.2.1",
51+
"gulp-sass": "^3.1.0",
52+
"gulp-size": "^2.1.0",
53+
"gulp-uglify": "^3.0.0",
54+
"gulp-useref": "^3.1.5",
55+
"main-bower-files": "^2.13.1",
56+
"rimraf": "^2.6.2",
57+
"run-sequence": "^1.2.2",
58+
"sass-lint": "^1.12.1",
59+
"wiredep": "^4.0.0"
60+
},
61+
"icons": {
62+
"fontName": "vbase-icon",
63+
"className": "vbase-icon"
64+
}
65+
}

0 commit comments

Comments
 (0)