Giter VIP home page Giter VIP logo

yii2-asset-clean's Introduction

Yii2 console command to clean web/assets/ directory

This extension added command 'asset/clean' to console application for removes caches from Yii's web/assets/ directory.

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require assayer-pro/yii2-asset-clean:dev-master

or add

"assayer-pro/yii2-asset-clean": "dev-master"

to the require section of your composer.json file.

Usage

To use this extension, add the following code in your application configuration (console.php):

'controllerMap' => [
    'asset' => [
        'class' => 'assayer-pro\assetClean\AssetController',
    ],
],

Then call the extension from the command line

/path/yii/web/assets$ ls -l
total 4
lrwxrwxrwx 1 www-data www-data 58 Oct 27 17:49 114607b9 -> /path/yii/vendor/bower/some-package
lrwxrwxrwx 1 www-data www-data 65 Oct 27 17:49 2466e1a -> /path/yii/vendor/bower/some-package2 
lrwxrwxrwx 1 www-data www-data 50 Oct 27 17:49 420da4e -> /path/yii/vendor/yiisoft/yii2/assets
lrwxrwxrwx 1 www-data www-data 55 Oct 27 17:49 85c56229 -> /path/yii/vendor/fortawesome/font-awesome
lrwxrwxrwx 1 www-data www-data 56 Oct 27 17:49 e8db1cdd -> /path/yii/vendor/yiisoft/yii2-debug/assets

/path/yii$ php yii asset/clean
Cleaning assets dir...
removed /path/yii/web/assets/114607b9, last modified Oct 27, 2015, 2:55:06 PM
removed /path/yii/web/assets/2466e1a, last modified Oct 12, 2015, 11:08:59 AM
removed /path/yii/web/assets/420da4e, last modified Mar 30, 2015, 7:50:00 AM
removed /path/yii/web/assets/85c56229, last modified Apr 28, 2015, 4:03:04 PM
removed /path/yii/web/assets/e8db1cdd, last modified Aug 6, 2015, 4:14:06 PM
Done. Assets dir cleaned

For ignore some directories add ignoreDirs property, e.g.

'controllerMap' => [
    'asset' => [
        'class' => 'assayer-pro\assetClean\AssetController',
        'ignoreDirs' => ['js', 'css'],
    ],
],

Additional arguments

--assetsDir: string (defaults to '@webroot/assets')
  assets cached directory

--quiet: boolean, 0 or 1 (defaults to 0)
  quiet;  do  not  write  anything to standard output.

--verbose: boolean, 0 or 1 (defaults to 0)
  echo rules being run, dir/file being deleted

yii2-asset-clean's People

Contributors

serge-larin avatar scrutinizer-auto-fixer avatar

Watchers

Dmytro Raschepkin 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.