Git Product home page Git Product logo

gulp-boilerplate's Introduction

Build Status

Gulp boilerplate

a boilerplate for your gulp files!

  • Uses gulp version 4 😎
  • Markup compilation
  • Stylesheet compilation
  • Script compilation
  • Source linting
  • Static server with automatic live reload/style injection

The aim is to get you up and running with something in gulp quickly!

Currently the boilerplate makes use of pug, stylus and es6/babel via rollup. But these technologies could easily be swapped out/removed based on your requirements.

The general presumption is that most projects require some form of markup, style and script compilation in addition to watching. This bundled in with some local static server capability if required.

The idea is that you will fork your own version and adapt it to fit in with the tech stack you are using and the tasks you need.

There are many alterations you could make.

For example;

  • You don't use pug, you remove the need for pug by adjusting your markup tasks to simply export markup to a desired destination post linting.
  • You need browserify so you adjust your compilation task to make use of browserify bundling.
  • You don't use stylus and you prefer SASS so you swap out the preprocessor package being used.

Usage

As a prerequisite it's assumed you have npm/yarn installed and the gulp-cli.

  1. Clone the repo

     git clone https://github.com/jh3y/gulp-boilerplate.git
    
  2. Install dependencies

     npm install / yarn
    
  3. Start gulp

     gulp
    
  4. Start hacking away with super fast livereload goodness.

Structure

You could have a gulpfile with all your tasks in one file. But, if your task list grows and it starts becoming a case of having to hunt through the file to refactor/make changes, it might be easier to split up your file and refactor your tasks into separate modules.

Tasks live under the build-tasks folder in relevant modules. For example, script related functions live within scripts.js. Each module exports aptly named functions such as compile, lint and watch. These are invoked from the gulpfile.

Tasks

You can see all available tasks with gulp -T. This will print out a list of available tasks and their respective metadata 😎

License

MIT


Any problems or questions, feel free to post an issue or tweet me, @_jh3y!

@jh3y 2018 πŸ˜„

gulp-boilerplate's People

Contributors

jh3y avatar makskokhtenko avatar mithun-daa avatar rzvnb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gulp-boilerplate's Issues

I ran `gulp` and I got errors

I ran gulp and I got the errors

[08:19:08] Failed to load external module @babel/register
[08:19:08] Failed to load external module babel-register
[08:19:08] Failed to load external module babel-core/register
[08:19:08] Failed to load external module babel/register
C:\Users\finnm\OneDrive\Desktop\min.io\gulp-boilerplate\gulpfile.babel.js:1
(function (exports, require, module, __filename, __dirname) { import gulp from 'gulp'
                                                              ^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at execute (C:\Users\finnm\AppData\Roaming\npm\node_modules\gulp-cli\lib\versioned\^3.7.0\index.js:28:18)

Revisit task names

Revisit task names so things are consistently named by action:sourceType.

For example; currently there are things like markup:watch and styles:compile but it would be better if things were named the other way round.

Intuitively, I would think compile:script and lint:script or watch:markup and not the other way round.

@jh3y

Separating stylus files

Hello again!

I have a duplication of CSS becouse files with @import сombining. How can I compile only one index stylus file?

dublicate

wanted plugins

Hello!
It is gonna be great if you will add plugins 'kouto-swiss' and 'typographic'. Thank you.

@babel/register

At the very top of the log output:
Failed to load external module @babel/register
As a side note:
npm i babel-register
does not correct the issue.
I've been trying to solve this problem, no luck yet.

Compile Scripts Gets Slow Adding Browserify

So I added Browserify into the compile scripts task, but just including a basic call to it in Scripts - Compile slows down to about 9 seconds. I'm only working with jQuery at the moment.

I wonder if there's a better way to add it than just throwing a call to browserify as a pipe in compile. Any guidance to improve performance would be very appreciated.

Better way to handle task names across files/modules

One issue seems to be as tasks are given string names and then used in various locations, it can be easy to write the wrong task name.

For example; scripts:compile or compile:scripts.

One way round this would be to have a module declaring task names that is used by files that need to reference task names. Something utilising key-mirror perhaps.

This issue came about from #8

@jh3y

TypeError: _gulp2.default.parallel is not a function

Thanks for this boilerplate, but it can't start with this package.
TypeError: _gulp2.default.parallel is not a function
You should install gulpjs/gulp.git#4.0 before. And it will work fine~!
Update the docs ;)

Deploy images

Hello here!
I have a problem with deploying images to the gh-pages.
Can u explain me how to do this right? How to config folders?

Markup compilation on deployment would discard data options

A real quick win bug here.

Currently markup compilation uses pug.

The options used for pug are as follows;

pug: {
  pretty: true,
  data  : {
    name       : pkg.name,
    description: pkg.description
  }
},

When markup is compiled, these options are only used when we aren't using the deploy environment.

.pipe(env.deploy ? plugins.pug(): plugins.pug(opts.pug))

But actually all we want to do is set the pretty option to false if it's true.

if (env.deploy && opts.pug.pretty) opts.pug.pretty = false;

@jh3y

Script.js Task has a problem with npm packages

i run this command for adding package from npm

npm install animejs --save

in index.js

import anime from 'animejs';

error

'anime' is defined but never used no-unused-vars
node_modules\animejs\anime.min.js (5:426) The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten

gulp-autoprefixer is not perfect

Hello! I found a problem with gulp-autoprefixer which have bad browser support. For exemple you can't
make a display: -webkit-flexbox prefix which need for safari4 (iphone 4++).
For solve this problem i did use the postcss plugin.
Just for you know.

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.