Giter VIP home page Giter VIP logo

magento-2-gulp's Introduction

magento-2-gulp

Gulp for Magento 2

As a Magento 2 frontend developer you might have noticed that less to css compilation process is slow with grunt and it takes more time to rebuild everything making you an inefficient developer.

However, you could solve this problem with Gulp. Gulp is a task / build runner which uses Node.js for web development. The main difference between Gulp and Grunt lies in how they deal with their automation tasks inside.

Gulp uses Node Stream while Grunt uses temp files. Therefore, Gulp compilation is faster compared to Grunt.

Comparing with Grunt

GulpGrunt
Compilation of all themes (10 files):16sec33sec
Custom theme compilation (2 files)4.5s11.2s

Installation

  1. Download as a zip file or clone this in to ur pc.

  2. Copy "gulpfile.js" and "package.json" in to the root directory (codepool)

  3. Install node.js for your OS: https://nodejs.org/en/

  4. Install gulp globaly using npm install -g gulp-cli

  5. Install modules: run a command in a root directory of your project "npm install".
    (If you alrady instaled Grunt please remove node_module directory)

How to run

  1. Run : gulp exec --theme ex: gulp exec --luma
    Or: php bin\magento dev:source-theme:deploy --locale="en_AU" --area="frontend"
    --theme="VendorName/themeName"

  2. Run : gulp deploy --theme ex: gulp deploy --luma
    Or: php bin\magento setup:static-content:deploy en_AU

  3. Run gulp command in the root directory with arguments or without. Examples:
    3.a. Compilation of all themes: gulp
    3.b. Compilation of certain theme: gulp less --luma
    3.c. Watcher of certain theme: gulp watch --luma
    3.d. Compilation of certain theme with minification (+~2.5s): gulp less --luma --min
    3.e. Compilation of certain theme with sourcemap(+~1.5s), can't be used with minification: gulp less --luma --map
    3.f. Compilation with live reload: gulp less --luma --live
    3.g. Watcher with liveReload: gulp watch --luma --live
    3.h. For clear the magento cache: gulp cache-flush

  4. For using liveReload install extension for your browser: http://livereload.com/
    4.a. Turn on the extension on the page of project.

magento-2-gulp's People

Contributors

subodha avatar

Watchers

James Cloos avatar Hiep Nguyen 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.