Coder Social home page Coder Social logo

cambricorp / composer-assets-installer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from semji/composer-assets-installer

0.0 1.0 0.0 28 KB

Composer Assets Installer provides a fast and easy way to copy the assets of your Composer packages into your public folder. You only have to chose one or multiple asset directories of the target in your "composer.json" file.

License: MIT License

PHP 100.00%

composer-assets-installer's Introduction

Composer Assets Installer Build Status

Composer Assets Installer provides a fast and easy way to copy the assets of your Composer packages into your public folder. You only have to chose one or multiple asset directories of the target in your "composer.json" file.

Code Example

Here is the composer.json file of a distant Composer package we want to use in our project :

{
    "require": {
        "reputation-vip/composer-assets-installer": "~1.0"
    },
    "name": "reputation-vip/required-distant-package",
    "extra": {
        "assets-dir" : "public"
    }
}

Here is the composer.json file of our project :

{
    "require": {
        "reputation-vip/composer-assets-installer": "~1.0",
        "my/required-distant-package": "~1.0"
    },
    "extra": {
        "assets-dir" : "web"
    }
}

Then, the assets will be accessible through the following path: web/my/required-distant-package.

Motivation

As members of the Reputation VIP's development team, we are used to creating full Composer packages, embedding a javascript logic and a css layer.

When we first started using Composer, we were somehow frustrated by it's lack of asset handling. Indeed, Composer forced us to manually copy the assets into our public directory. Furthermore, every time we updated the package, we had to repeat this task.

That's why we needed a tested, documented and easily configurable Composer plugin which allowed us to keep control on the asset directories.

Installation

You simply have to add the following line to the requirements of your composer.json file:

"require": {
    "reputation-vip/composer-assets-installer": "~1.0"
}

Then, you can specify the target for your asset directory (web for example):

"extra": {
    "assets-dir": "web"
}

API Reference

With this solution, you can specify as many targets as you want:

"extra": {
    "assets-dir": {
        "js": "web/js",
        "css": "web/css"
     }
}

composer-assets-installer's People

Contributors

neverdane avatar bobey avatar

Watchers

Carl Price 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.