[update] Style Home page

This commit is contained in:
brunosimon
2016-08-30 02:05:01 +02:00
parent d4d852f356
commit 81331c4f34
33 changed files with 745 additions and 319 deletions
+37 -69
View File
@@ -2,17 +2,10 @@ var gulp = require( 'gulp' ),
concat = require( 'gulp-concat' ),
uglify = require( 'gulp-uglify' ),
watch = require( 'gulp-watch' ),
minify_css = require( 'gulp-minify-css' ),
autoprefixer = require( 'gulp-autoprefixer' ),
postcss = require( 'gulp-postcss' ),
precss = require( 'precss' ),
postcss_import = require( 'postcss-import' ),
cssnano = require( 'cssnano' ),
sourcemaps = require( 'gulp-sourcemaps' ),
spritesmith = require( 'gulp.spritesmith' ),
merge = require( 'merge-stream' ),
gulp_sourcemaps = require( 'gulp-sourcemaps' ),
plumber = require( 'gulp-plumber' ),
gulp_rename = require( 'gulp-rename' ),
gulp_stylus = require( 'gulp-stylus' ),
browser_sync = require( 'browser-sync' ).create();
var path = '../';
@@ -44,66 +37,43 @@ var path = '../';
gulp.task( 'stylesheet', function()
{
var requires = [
autoprefixer,
precss,
postcss_import,
cssnano,
];
// Post CSS
return gulp.src( path + 'stylesheet/main.css' )
.pipe( sourcemaps.init() )
.pipe( plumber( function( error )
{
console.log( error );
this.emit( 'end' );
return gulp.src( path + 'stylus/style.styl' )
.pipe( gulp_sourcemaps.init() )
.pipe( plumber() )
.pipe( gulp_stylus( {
compress: true,
} ) )
.pipe( postcss( requires ) )
.pipe( gulp_rename( {
// dirname: "main/text/ciao",
// basename: "aloha",
// prefix: "bonjour-",
suffix: ".min",
// extname: ".md"
} ) )
.pipe( sourcemaps.write( '.' ) )
.pipe( gulp.dest( path + 'stylesheet/' ) )
.pipe( gulp_sourcemaps.write( '.' ) )
.pipe( gulp.dest( path + 'stylesheet' ) )
.pipe( browser_sync.stream( { match: '**/*.css' } ) );
});
/**
* SPRITES
*/
gulp.task( 'sprites', function()
{
var sprite_data = gulp.src( path + 'images/sprites/**/*.{png,jpg}' )
.pipe( plumber() )
.pipe( spritesmith( {
// Options
padding : 4,
// var requires = [
// autoprefixer,
// precss,
// postcss_import,
// cssnano,
// ];
// Default
imgName : 'sprites.png',
cssName : '_sprites.scss',
imgPath : path + 'images/sprites.png',
// Retina
retinaSrcFilter: [path + 'images/sprites/*-2x.png'],
retinaImgName: 'sprites-2x.png',
retinaImgPath: path + 'images/sprites-2x.png'
} ) );
var img_stream = sprite_data.img
.pipe( plumber() )
.pipe( gulp.dest( path + 'images/' ) );
var css_stream = sprite_data.css
.pipe( plumber() )
.pipe( gulp.dest( path + 'sass/base/' ) );
return merge( img_stream, css_stream );
// // Post CSS
// return gulp.src( path + 'stylesheet/main.css' )
// .pipe( gulp_sourcemaps.init() )
// .pipe( plumber( function( error )
// {
// console.log( error );
// this.emit( 'end' );
// } ) )
// .pipe( postcss( requires ) )
// .pipe( gulp_rename( {
// // dirname: "main/text/ciao",
// // basename: "aloha",
// // prefix: "bonjour-",
// suffix: '.min',
// // extname: ".md"
// } ) )
// .pipe( gulp_sourcemaps.write( '.' ) )
// .pipe( gulp.dest( path + 'stylesheet/' ) )
// .pipe( browser_sync.stream( { match: '**/*.css' } ) );
});
/**
@@ -111,10 +81,11 @@ gulp.task( 'sprites', function()
*/
gulp.task( 'browser_sync', function()
{
console.log('ok');
browser_sync.init( {
proxy:
{
target: 'http://localhost:3000',
target: 'http://localhost:1571',
ws : true
}
} );
@@ -125,7 +96,6 @@ gulp.task( 'browser_sync', function()
*/
gulp.task( 'watch', function()
{
console.log('ok');
// // JS
// watch(
// [
@@ -140,9 +110,7 @@ gulp.task( 'watch', function()
// Stylesheet
watch(
[
path + 'stylesheet/**',
'!' + path + 'stylesheet/main.min.css',
'!' + path + 'stylesheet/main.min.css.map'
path + 'stylus/**',
],
function()
{
+2 -9
View File
@@ -7,20 +7,13 @@
"dependencies": {
"autoprefixer": "^6.4.0",
"browser-sync": "^2.13.0",
"cssnano": "^3.7.4",
"gulp": "^3.8.10",
"gulp-autoprefixer": "^2.1.0",
"gulp-concat": "^2.4.3",
"gulp-minify-css": "^0.3.13",
"gulp-plumber": "^1.1.0",
"gulp-postcss": "^6.1.1",
"gulp-rename": "^1.2.2",
"gulp-sourcemaps": "^1.6.0",
"gulp-stylus": "^2.5.0",
"gulp-uglify": "^1.1.0",
"gulp-watch": "^3.0.0",
"gulp.spritesmith": "^6.2.1",
"merge-stream": "^1.0.0",
"postcss-import": "^8.1.2",
"precss": "^1.4.0"
"gulp-watch": "^3.0.0"
}
}