Git Product home page Git Product logo

gulp-helpers's Introduction

Gulp Helpers

Gulp helper functions for a Laravel application/package which are much faster than Laravel Elixir.

Installation

npm install --save-dev gulp git+https://github.com/mzur/gulp-helpers.git

Usage

var gulp = require('gulp');
var h = require('gulp-helpers');

// get the publish function for a Laravel package
// the optional second argument specifies the tag for the publish task
var publish = h.publish('Your\\Package\\Namespace\\ServiceProvider', 'public');

// change the sass and js source paths
// default are 'resources/assets/{sass,js}/'
h.paths.sass = 'src/resources/assets/sass/';
h.paths.js = 'src/resources/assets/js/';

// change the public/destination path
// default is 'public/assets/'
h.paths.public = 'src/public/assets/';

// change the Laravel artisan location
// default is '../../../artisan'
h.paths.artisan = '../../../artisan'

// build sass
gulp.task('sass', function () {
   // source: 'src/resources/assets/sass/main.scss'
   // destination 'src/public/assets/styles/main.css'
   h.sass('main.scss', 'main.css');
   // You can use @imports relative to the node_modules directory
   // in your SASS files, too!
});

// build js
gulp.task('js', function (cb) {
   // source: 'src/resources/assets/js/**/*.js'
   // destination 'src/public/assets/scripts/main.js'
   h.js('**/*.js', 'main.js', cb);
});

gulp.task('watch', function () {
   gulp.watch(h.paths.sass + '**/*.scss', ['sass']);
   gulp.watch(h.paths.js + '**/*.js', ['js']);
   gulp.watch(h.paths.public + '**/*', publish);
});

gulp.task('default', ['sass', 'js'], publish)

With this example you can run gulp to build your assets and gulp watch to start the watcher. To minify the assets, run gulp --production.

After each build the publish task is run which will call the command:

'php ../../../artisan vendor:publish --tag="public" --provider="Your\\Package\\Namespace\\ServiceProvider" --force'

You can just as well omit the publish task if you work with the application itself and not a package installed in vendor/.

gulp-helpers's People

Contributors

mzur avatar

Stargazers

William Whitmire avatar Luis Carranza Candia avatar

Watchers

James Cloos avatar  avatar Luis Carranza Candia 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.