Git Product home page Git Product logo

m2-regenerate's Introduction

cadence/m2-regenerate

This Gruntfile and associated task are meant to allow development of a Magento 2 installation in developer mode without having to clear the var/generation folder.

Where do the files go

Unzip the files into {MAGENTO_ROOT}/bin/regenerate

How do I use it?

Once you've unzipped the files, update the Gruntfile.js to make sure the path to the Magento 2 app folder is correct (if you followed the directions above, it should be).

You can then run the below command to install, assuming you change into the {MAGENTO_ROOT}/bin/regenerate folder

#!bash
npm install --dev

And the below command to run

#!bash
grunt cadence:regenerate

How does it work?

The grunt task uses grunt-contrib-watch to look for changes to the below files:

  • app/etc/config.php
  • app/**/di.xml
  • app/code/**/*.php

Anytime the global config file or a di.xml file is changed, the script will clear the entire var/generation folder.

If a specific php file is changed, the script will attempt to remove the generated Interceptor and/or Factory for that php file.

Troubleshooting

The biggest issue I've run into is accidentally running bin/magento setup:di:compile in my Magento 2 environment. If Magento detects any .ser files in var/di, it will run in a special "compiled" mode where it doesn't automatically generate code.

Why did you add your own Gruntfile.js?

For simplicity's sake, I wanted this to be a stand-alone app that you exclude from git and only run on your development box.

Where can I get more information?

See our official support guide here: https://www.cadence-labs.com/2017/07/magento-2-automatically-regenerate-interceptors-factories-vargeneration/

m2-regenerate's People

Contributors

cadencelabs-master avatar

Watchers

 avatar  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.