2017 © Pedro Peláez
 

magento2-module magento2-copy-theme-override

Magento 2 command to automatically copy files into active theme

image

jahvi/magento2-copy-theme-override

Magento 2 command to automatically copy files into active theme

  • Sunday, July 29, 2018
  • by jahvi
  • Repository
  • 1 Watchers
  • 1 Stars
  • 651 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 13 % Grown

The README.md

Magento 2 Copy Theme Override Command

Build Status Coverage Status, (*1)

🎩 Magento 2 command to automatically copy files into active theme., (*2)

screen2, (*3)

Installation

  1. Install via composer composer require jahvi/magento2-copy-theme-override --dev
  2. Run php bin/magento setup:upgrade

How it works?

After installing the extension you will have access to a new command:, (*4)

php bin/magento dev:copy-theme-override $file_path

This takes a single $file_path argument which is the absolute path of the CSS, LESS, JS, PHTML or HTML file you want to override in your theme, so for example to override the product/list.phtml template you'd run:, (*5)

php bin/magento dev:copy-theme-override /var/www/magento2/vendor/magento/module-catalog/view/frontend/templates/product/list.phtml

And it will copy the file into your theme as:, (*6)

/var/www/magento2/vendor/magento/app/design/Sample/theme/Magento_Catalog/templates/product/list.phtml

Setting up your IDE

By itself the command is not very useful but most IDEs or code editors provide a way to run custom commands using keyboard shortcuts that will help simplify this workflow, below are some examples of a few popular ones., (*7)

VS Code

  1. Create a .vscode/tasks.json file in the project root with the following content:
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Copy Theme Override",
            "type": "shell",
            "command": "php bin/magento dev:copy-theme-override ${file}",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}
  1. Open the file to override.
  2. Run build task shortcut, by default Shift + Cmd + B or Ctrl + Shift + B on Windows/Linux.

Sublime Text

  1. Create new build system Tools > Build System > New Build System... with the following content:
{
    "shell_cmd": "php bin/magento dev:copy-theme-override $file",
    "working_dir": "$folder"
}
  1. Open the file to override.
  2. Run Build task, by default Cmd + B or Ctrl + B on Windows/Linux.

The Versions

29/07 2018

dev-master

9999999-dev

Magento 2 command to automatically copy files into active theme

  Sources   Download

MIT

The Requires

 

The Development Requires

29/07 2018

1.1.4

1.1.4.0

Magento 2 command to automatically copy files into active theme

  Sources   Download

MIT

The Requires

 

The Development Requires

24/06 2017

1.1.0

1.1.0.0

Magento 2 command to automatically copy files into active theme

  Sources   Download

MIT

The Requires

 

The Development Requires

09/04 2017

1.0.0

1.0.0.0

Magento 2 command to automatically copy files into active theme

  Sources   Download

MIT

The Requires

 

The Development Requires