Init files for CodersLab students
Last active
April 29, 2018 08:09
-
-
Save DariuszLuber/c48d76934077b847d4898ab49e693429 to your computer and use it in GitHub Desktop.
Gulp-Sass-Project-Init
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var sass = require('gulp-sass'); | |
//var sftp = require('gulp-sftp'); | |
var browserSync = require('browser-sync').create(); | |
var sourcemaps = require('gulp-sourcemaps'); | |
var prefix = require('gulp-autoprefixer'); | |
// static server | |
//Static Server + watching scss/ html file | |
gulp.task('serve', ['sass'], function() { | |
browserSync.init({ | |
server: "./" | |
}); | |
gulp.watch("./scss/**/*.scss", ['sass']); | |
//Deploy na ftp | |
// gulp.watch("./css/*", ['deployCss']); | |
// gulp.watch("./*.php", ['deployMain']); | |
gulp.watch("./**/*.css").on('change', browserSync.reload); | |
gulp.watch("./**/*.html").on('change', browserSync.reload); | |
}); | |
gulp.task('sass', function() { // funkcja callback | |
return gulp.src('./scss/**/*.scss') //-->zrodlo | |
.pipe(sourcemaps.init()) | |
.pipe(sass({errLogToConsole:true})) | |
.pipe(prefix("last 1 version", "> 1%", "ie 8", "ie 7")) | |
.pipe(sourcemaps.write()) | |
.pipe(gulp.dest('css')) // --> gdzie laduja | |
.pipe(browserSync.stream()) | |
}) | |
gulp.task('default', ['serve']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir js | |
mkdir css | |
mkdir scss | |
npm install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "init", | |
"version": "1.0.0", | |
"description": "", | |
"main": "gulpfile.js", | |
"dependencies": { | |
}, | |
"devDependencies": { | |
"gulp": "^3.9.1", | |
"browser-sync": "^2.18.1", | |
"gulp-sass": "^2.3.2", | |
"gulp-sourcemaps": "^2.2.0", | |
"gulp-autoprefixer": "^4.0.0" | |
}, | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"gulp": "./node_modules/.bin/gulp" | |
}, | |
"author": "", | |
"license": "ISC" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment