in Basset, Laravel, Our Authors

How to setup Basset in Lumen Application?

Basset now supports Lumen applications also. With just a little setup you can run Basset with all the features as with regular Laravel installation.

Setup

Create your Lumen applicaton with:

composer create-project laravel/lumen --prefer-dist

This will create Lumen project in lumen folder. Now you need to install laravel-basset with npm package manager. Run:

npm install gulp laravel-basset

And if you have package.json file then run:

npm install gulp laravel-basset --save-dev

Now you will need to create a Gulpfile.js for Gulp, and a collections.js for your collections configuration.

Into your Gruntfile.js write:

var basset = require('laravel-basset');

basset.loadFile("./collections.json");

And in your collections.json setup your first app collection:

{
  collections: {
    app: {
      browserify: true
      css: [
        "*.scss",
      ]
    }
  }
}

Add files your collection files to resources. Based on the configuration your files can be:

resources/assets/app/app.js
resources/assets/app/styles.scss

Install Basset through Composer with:

composer require thelegacy/basset

Now the only thing that is left is Lumen setup. Go into /bootstrap/app.php and add:

// For Livereload middleware
$app->middleware([
    'Basset\Livereload',
]);

// And Basset Service provider
$app->register('Basset\BassetServiceProvider');

You will now need to create public/builds folder where the asset files will be built

Usage

Now you can build your app with:

gulp build

Start watch mode with:

gulp basset:watch

And use collections in views with:

@stylesheets('app')
@javascripts('app')

You now have all setup for using Basset with the great Lumen framework, and you  can follow all the rest Basset articles.

Basset – asset collections for Laravel

How to pass data to JavaScript with Basset?

How to publish collection files with Basset?

How to use Font Awesome with Basset

Share this ...Tweet about this on TwitterShare on FacebookEmail this to someoneShare on RedditShare on Google+Share on LinkedInPin on Pinterest