All Projects → Sammyjo20 → Lasso

Sammyjo20 / Lasso

Licence: mit
Lasso is a Laravel package created to make your deployments blazing fast.

Projects that are alternatives of or similar to Lasso

Laravue
Admin dashboard for enterprise Laravel applications built by VueJS and Element UI https://laravue.dev
Stars: ✭ 1,964 (+805.07%)
Mutual labels:  webpack, laravel
Laravel Mix
The power of webpack, distilled for the rest of us.
Stars: ✭ 4,910 (+2162.67%)
Mutual labels:  webpack, laravel
Laravel Vue
运用laravel5.4 + vue2.0 + elementui
Stars: ✭ 276 (+27.19%)
Mutual labels:  webpack, laravel
Coyote
4programmers.net
Stars: ✭ 61 (-71.89%)
Mutual labels:  webpack, laravel
Laravel Blog
Laravel 8.0 blog application with Vue.js, Homestead, Horizon, Telescope and Pusher
Stars: ✭ 1,248 (+475.12%)
Mutual labels:  webpack, laravel
Rubel
Rubel is a cms built with Laravel and React.
Stars: ✭ 70 (-67.74%)
Mutual labels:  webpack, laravel
Minisauras
An open-source CI/CD automation tool based on GitHub Actions that pulls all the JavaScript and CSS files from your base branch, minify them and creates a pull-request with a new branch.
Stars: ✭ 40 (-81.57%)
Mutual labels:  webpack, ci-cd
Anvel
Angular 2 Laravel Starter Kit
Stars: ✭ 102 (-53%)
Mutual labels:  webpack, laravel
Imall
基于Laravel5.2,Vue.js1.0的微信商城,用于熟悉 Laravel、Vuejs、Webpack、Gulp 的结合使用,已不维护及更新。(1MB单核基础服务器,浏览请耐心等待图片加载...)
Stars: ✭ 168 (-22.58%)
Mutual labels:  webpack, laravel
Laravel Pagseguro
Checkout Transparente e Pagamentos Recorrentes (Assinaturas)
Stars: ✭ 213 (-1.84%)
Mutual labels:  laravel
Laravel Download Link
A simple Laravel package for generating download links with options such as expire time, IP restrictions, etc.
Stars: ✭ 215 (-0.92%)
Mutual labels:  laravel
Peco
nothing here, move on..
Stars: ✭ 213 (-1.84%)
Mutual labels:  webpack
Makisu
Fast and flexible Docker image building tool, works in unprivileged containerized environments like Mesos and Kubernetes.
Stars: ✭ 2,409 (+1010.14%)
Mutual labels:  ci-cd
Imitate One
用vue+webpack + node仿制的One[一个 ]app
Stars: ✭ 216 (-0.46%)
Mutual labels:  webpack
Laravel State Machine
Winzou State Machine service provider for Laravel
Stars: ✭ 213 (-1.84%)
Mutual labels:  laravel
Nx Admin
👍 A magical 🐮 ⚔ vue admin,记得star
Stars: ✭ 2,497 (+1050.69%)
Mutual labels:  webpack
Laravel Custom Casts
Make your own custom cast type for Laravel model attributes
Stars: ✭ 213 (-1.84%)
Mutual labels:  laravel
Nova Button
Add buttons on Nova index, detail and lens views.
Stars: ✭ 213 (-1.84%)
Mutual labels:  laravel
Vue Element Starter
Vue starter with Element-UI [READY, unmaintained now]
Stars: ✭ 216 (-0.46%)
Mutual labels:  webpack
Minipack
📦 A simplified example of a modern module bundler written in JavaScript
Stars: ✭ 2,625 (+1109.68%)
Mutual labels:  webpack

Lasso

Lasso

Asset wrangling for Laravel made simple.

Latest Stable Version Total Downloads License Code style

Official Website

Introduction

Deploying Webpack assets in Laravel can be a nightmare. One problem developers have is dealing with their built assets (created by Webpack/Laravel Mix). Do you store them in version control? Do you deploy them on the server? What if I'm working with a team? Each of these solutions for assets can cause headaches for the developer, including merge conflicts and slowing down servers.

Lasso is a Laravel package designed to take the headaches out of deploying assets to your servers. It works great on load balanced environments too.

What does Lasso do?

Lasso compiles your assets on your local machine or within Continuous Integration (e.g GitHub Actions) and then uploads the assets to one of your Laravel Filesystems. This harnesses the power of your local machine which is likely much more powerful than the server.

During deployment, Lasso will then download your assets from the filesystem. It uses Git to keep track of the last asset bundle created, as well as automatically cleans old bundles.

Installation

Lasso requires Laravel 6+ and PHP 7.3 or higher. To install Lasso, simply run the composer require command below:

composer require sammyjo20/lasso

After that, run the command below to create the lasso.php config file:

php artisan vendor:publish --tag=lasso-config

Configuration

Now make sure to configure the lasso.php config file in your app/config directory. Make sure to specify a Filesystem Disk you would like Lasso to use.

If you have multiple projects, make sure to change the "upload_to" path, otherwise you may have asset conflicts in your applications.

Getting Setup

Make sure to add all of your public assets that are created by Webpack/Laravel Mix to your .gitignore file. Make sure to also add the ".lasso" directory to your .gitignore file.

Example:

mix-manifest.json
public/css/*
public/js/*
.lasso

The .lasso folder is a temporary directory created by Lasso to keep assets while they're being zipped up. This folder is automatically created and deleted, but it's good to ignore this directory anyway, just in case Lasso falls over before it reaches the cleanup phase.

Recommended Usage

Lasso comes with two commands that should be used by your project/deployment process. The recommended usage is to run the "publish" command on your local machine, which is likely much more powerful than Continuous Integration or compiling on the server.

Publish

The publish command should be executed when you would like to upload/publish new assets to your application. Lasso will run the provided script (e.g npm run production) and then zip up the files created by the compiler (e.g Webpack).

php artisan lasso:publish

After running this command, Lasso will create a "lasso-bundle.json" file in your application's root directory. This is the recommended approach as when you commit the file, Lasso will use this to download the latest bundle relating to your commit. If you don't use Git, for example if you are compiling assets within Continuous Integration, you can add the --no-git flag to the command.

Warning: When using the --no-git flag, versioning will be limited as the lasso-bundle.json is stored in your Filesystem, rather than your repository. Using Git is the recommended approach.

Pull

The pull command should then be executed on your deployment script, or on the servers which will require the assets to be on. Simply run the command below. If you are using Laravel Forge, add this command to your deployment script. If you are using Laravel Envoyer, add this to the list of hooks during your deployment. It should be run on every server.

php artisan lasso:pull

Usage within Continuous Integration (CI) e.g Github Actions

To use Lasso during continuous integration, it's recommended to run the php artisan lasso:publish command, and then commit the "lasso-bundle.json" file which is created. If you aren't able to commit files during your CI process, use the --no-git flag on the command, e.g: php artisan lasso:publish --no-git

Read this excellent blog post by Alex Justesen on how to integrate Lasso with your CI/CD pipeline: https://lasso-ci-cd.alexjustesen.com/

Multiple Environments

Out of the box, Lasso supports multi-environment applications. If your application has a staging environment, for example - you can use the LASSO_ENV environment variable to set the current environment. On your web servers:

LASSO_ENV=staging

Webhooks

Lasso can also trigger webhooks when a command has been executed successfully. Simply list the URLs in the "webhooks" array in the lasso.php config file.

/*
* Lasso will can also trigger Webhooks after its commands have been
* successfully executed. You may specify URLs that Lasso will POST
* to, for each of the commands.
*/
'webhooks' => [

  /*
  * Specify which webhooks should be triggered after a successful
  * "php artisan lasso:publish" command execution.
  */
  'publish' => [
    //
   ],

  /*
   * Specify which webhooks should be triggered after a successful
   * "php artisan lasso:pull" command execution.
   */
  'pull' => [
    //
  ]

],

Cleanup

Lasso will automatically try to keep your Filesystem clean, and will automatically delete old bundles. You can increase/decrease the amount of Bundles Lasso will keep per enviroment by setting the max_bundles configuratiion variable in the config/lasso.php file.

/*
 * Lasso will automatically version the assets. This is useful if you
 * suddenly need to roll-back a deployment and use an older version
 * of built files. You can set the maximum amount of files stored here.
 */
'max_bundles' => 5,

Excluded files/directories

Lasso will copy the public directory during it's publish process. If you have any files or directories that you would like Lasso to ignore during this process, specify them in the excluded_files and excluded_directories configuation variables in the config/lasso.php file.

/*
 * If there any directories/files you would like to Lasso to
 * exclude when uploading to the Filesystem, specify them below.
 */
'excluded_files' => [],

'excluded_directories' => [],

Thanks

Special thanks to @codepotato for the logo! ❤️


Security

If you find any security related issues, please send me an email to [email protected].

And that's it! ✨

This is my first Laravel package, I really hope it's been useful to you, if you like my work and want to show some love, consider buying me some coding fuel (Coffee) ❤

Donate Java (the drink not the language)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].