Skip to content

Commit 6d21d32

Browse files
author
Michał Sajnóg
committed
[TR-3] - adding travis CI, refactoring gulp
1 parent 00628d2 commit 6d21d32

File tree

15 files changed

+173
-97
lines changed

15 files changed

+173
-97
lines changed

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
indent_size = 4
9+
indent_style = space
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
[*.md]
14+
trim_trailing_whitespace = false
15+
16+
[*.scss, *.css]
17+
indent_size = 2

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Enforce Unix newlines
2+
*.css text eol=lf
3+
*.scss text eol=lf
4+
*.html text eol=lf
5+
*.js text eol=lf
6+
*.md text eol=lf
7+
*.svg text eol=lf
8+
*.yml text eol=lf
9+
# Don't diff or textually merge source maps
10+
*.map binary

.gitignore

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1-
bower_components/
2-
node_modules/
3-
.DS_Store
1+
# Numerous always-ignore extensions
2+
*.diff
3+
*.err
4+
*.log
5+
*.orig
6+
*.rej
7+
*.swo
8+
*.swp
9+
*.vi
10+
*.zip
11+
*~
12+
13+
# OS or Editor folders
14+
._*
15+
.cache
16+
.DS_Store
17+
.idea
18+
.project
19+
.settings
20+
.tmproj
21+
*.esproj
22+
*.sublime-project
23+
*.sublime-workspace
24+
nbproject
25+
Thumbs.db
26+
27+
# Folders to ignore
28+
bower_components
29+
node_modules

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
language: node_js
2+
sudo: false
3+
node_js:
4+
- '0.12'
5+
6+
env:
7+
global:
8+
9+
install:
10+
- npm install -g gulp
11+
- npm install -g karma
12+
- npm install
13+
14+
cache:
15+
directories:
16+
- "$HOME/.nvm"

dist/aos.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/aos.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/aos.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulp/bundle.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
var gulp = require('gulp');
2+
var watchify = require('watchify');
3+
var browserify = require('browserify');
4+
5+
var uglify = require('gulp-uglify');
6+
var source = require('vinyl-source-stream');
7+
var buffer = require('vinyl-buffer');
8+
var gutil = require('gulp-util');
9+
var sourcemaps = require('gulp-sourcemaps');
10+
11+
var browserSync = require('browser-sync');
12+
var reload = browserSync.reload;
13+
14+
var browserifyOptions = {
15+
entries: ['./src/js/aos.js'],
16+
debug: true
17+
};
18+
19+
var bundle = watchify(browserify(browserifyOptions))
20+
.on('update', makeBundle)
21+
.on('log', gutil.log);
22+
23+
function makeBundle() {
24+
return bundle.bundle()
25+
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
26+
.pipe(source('aos.js'))
27+
.pipe(buffer())
28+
.pipe(sourcemaps.init({
29+
loadMaps: true
30+
}))
31+
.pipe(uglify({
32+
preserveComments: 'some'
33+
}))
34+
.pipe(sourcemaps.write('./'))
35+
.pipe(gulp.dest('./dist'))
36+
.pipe(reload({
37+
stream: true
38+
}));
39+
}
40+
41+
module.exports = makeBundle;

gulp/sass.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
var gulp = require('gulp');
2+
3+
var sass = require('gulp-sass');
4+
var autoprefixer = require('gulp-autoprefixer');
5+
var concat = require('gulp-concat');
6+
var minifyCss = require('gulp-minify-css');
7+
8+
var browserSync = require('browser-sync');
9+
var reload = browserSync.reload;
10+
11+
module.exports = function() {
12+
gulp.src('src/sass/*.scss')
13+
.pipe(concat('aos.scss'))
14+
.pipe(sass({
15+
errLogToConsole: true
16+
}))
17+
.pipe(autoprefixer({
18+
browsers: ['> 1%']
19+
}))
20+
.pipe(minifyCss())
21+
.pipe(gulp.dest('dist'))
22+
.pipe(reload({
23+
stream: true
24+
}));
25+
}

gulp/test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var gulp = require('gulp');
2+
var karma = require('karma').Server;
3+
4+
var isTravis = process.env.TRAVIS || false;
5+
var pathToKarmaConf = __dirname.replace('/gulp', '');
6+
7+
module.exports = function(done) {
8+
new karma({
9+
configFile: pathToKarmaConf + '/karma.conf.js',
10+
singleRun: isTravis
11+
}, done).start();
12+
};

0 commit comments

Comments
 (0)