GithubHelp home page GithubHelp logo

kennethmiller18 / jekyll-gulp-sass-browser-sync Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danielarturoalejoalvarez/jekyll-gulp-sass-browser-sync

0.0 1.0 0.0 16.96 MB

Software of Development with Jejyll,Gulp,Sass and BrowserSync.

HTML 22.65% Ruby 9.41% CSS 59.30% JavaScript 8.64%

jekyll-gulp-sass-browser-sync's Introduction

Jekyll-Gulp-Sass-Browser-Sync

Description

This application contains an automated framework system for the development and design of web pages. We will use Jekyll created in Ruby, Sass, Pug and BrowserSync.

Installation

Using Jekyll,Sass etc preferably.

$ gem install bundler jekyll

Usage

$ git clone https://github.com/DanielArturoAlejoAlvarez/Jekyll-Gulp-Sass-Browser-Sync.git [NAME APP]

$ npm install

$ gulp

Follow the following steps and you're good to go! Important:

alt text

Scaffold

+-- _includes
|   +-- header.html
|   +-- columns.html
+-- _layouts
|   +-- default.html
|   +-- posts.html
+-- _pugfiles
|   +-- header.pug
|   +-- columns.pug
+-- _site
|   +-- assets
+-- _assets
    +-- css
        +-- 0-tools
        |   +-- normalize.scss
        +-- 1-base
        +-- 2-modules
        +-- 3-sections
        |   +-- _header.sass
        |   +-- _about.sass
        +-- 4-layouts
        |   +-- home.sass
    |   +-- main.scss
    +-- img
    +-- js

+-- node_modules
+-- _config.yml
+-- .gitignore
+-- package.json
+-- 404.html
+-- index.html
+-- README.md

Coding

Config (gulpfile.js)

...
const gulp = require('gulp');
const sass = require('gulp-sass');
const cssnano = require('cssnano');
const autoprefixer = require('autoprefixer');
const sourcemaps = require('gulp-sourcemaps');
const postcss = require('gulp-postcss');
const uglify = require('gulp-uglify');
const rename = require('gulp-rename');
const cp = require('child_process');
const flatten = require('gulp-flatten');
const jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll';
const source = require('vinyl-source-stream');
//const concatjs = require('gulp-concat');
const browserSync = require('browser-sync').create();
const pug = require('gulp-pug');

const paths = {
  styles: {
    src: 'assets/css/main.scss',
    dest: '_site/assets/css',
    destsecond: 'assets/css'
  },
  scripts: {
    src: 'assets/js/main.js',
    dest: '_site/assets/js',
    destsecond: 'assets/js'
  },
  htmls: {
    src: '_pugfiles/**/*.pug',
    dest: '_includes/'
  }
};

function jekyllBuild() {
    return cp.spawn("bundle", ["exec", "jekyll", "build"], { stdio: "inherit" });
}

function style() {
  return gulp.src(paths.styles.src)
    .pipe(sass({
      includePaths: ['css'],
      outputStyle: 'expanded',
      onError: browserSync.notify
    }))
    .pipe(postcss([
      autoprefixer()
    ]))
    .pipe(gulp.dest(paths.styles.dest))
    .pipe(browserSync.reload({stream:true}))
    .pipe(gulp.dest(paths.styles.destsecond));
}

function js() {
  return gulp.src(paths.scripts.src)
  .pipe(rename({suffix: '.min'}))
  .pipe(uglify())
  .pipe(gulp.dest(paths.scripts.dest))
  .pipe(browserSync.reload({stream:true}))
  .pipe(gulp.dest(paths.scripts.destsecond));
}

function html() {
  return gulp.src(paths.htmls.src)
    .pipe(pug())
    .pipe(gulp.dest(paths.htmls.dest))
    .pipe(browserSync.reload({stream:true}))
}

function browserSyncServe(done) {
  browserSync.init({
    server: {
      baseDir: "_site"
    },
    notify: false
  })
  done();
}

function browserSyncReload(done) {
  browserSync.reload();
  done();
}

function watch() {
  gulp.watch(['assets/css/**/*.scss','assets/css/**/*.sass'], style)
  gulp.watch(['assets/js/**/*.js', '!assets/js/**/*.min.js'], js)
  gulp.watch(paths.htmls.src, html)
  gulp.watch(
    [
    '*.html',
    '_layouts/*.html',
    '_includes/*'
  ],
  gulp.series(jekyllBuild, browserSyncReload));
}

gulp.task('default', gulp.parallel(jekyllBuild, browserSyncServe, watch))

...

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/DanielArturoAlejoAlvarez/Jekyll-Gulp-Sass-Browser-Sync. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

jekyll-gulp-sass-browser-sync's People

Contributors

danielarturoalejoalvarez avatar

Watchers

Kenneth Miller avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.