npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ferling/laravel-multimix

v0.0.4

Published

Laravel-Mix helper for projects with complex & multi assets

Downloads

4

Readme

Laravel-Mix helper for projects with complex & multi assets.

🔥 Getting started

Since mix introduced in laravel 5.4 it is recommended to use this package for laravel >= 5.4 projects only.

Install package:

# NPM
npm install --save-dev laravel-multimix

# YARN
yarn add --dev laravel-multimix

Open your package.json and replace ugly scrips section with this:

  {
    "scripts": {
      "mix": "node node_modules/laravel-multimix/bin/mix"
    }
  }

Then you can run your tasks with this single command:

    # Usage syntax: npm mix [preset=dev] [package=app]
    
    # Example: run preset hot (with package app)
    npm mix hot
    
    # Example: run preset watch on package bootstrap
    npm mix watch bootstrap

🎌 Presets

presets are just different sets of flags and envs passed to webpack. They are basically same as default laravel package.json commands.

Available Presets

  • dev
  • watch
    • args: --watch
  • poll
    • args: --watch --watch-poll
  • hot
    • args: --hot --inline
    • entry: webpack-dev-server
  • production
    • env: production

📦 Packages

Packages are optional and available via MIX_PACKAGE env. It will do nothing by default. But is very useful when using with Utils. The philosophy behind packages is to having separate assets with different build workflow. This makes builds cleaner, faster and more efficient.

💁 Utils

Laravel MultiMix exposes some utils constant and functions.

  • MIX_PACKAGE : is same as package name argument
  • NPM : is relative path to node_modules
  • VENDOR : is relative path to resources/assets/vendor
  • output(package_name): generates path to public with this template: public/assets/{package}/
  • OUTPUT: is output for current MIX_PACKAGE

See example below for better understanding.

📚 Example

// webpack.mix.js

const {mix} = require('laravel-mix');
const {MIX_PACKAGE, NPM, VENDOR, OUTPUT, output} = require('laravel-multimix');

/*
 |--------------------------------------------------------------------------
 | Bootstrap
 | @package bootstrap
 |--------------------------------------------------------------------------
 */
if (MIX_PACKAGE === 'bootstrap') {
    // Bootstrap + RTL
    // generates public/assets/bootstrap/bootstrap.css
    mix.sass('resources/assets/sass/bootstrap.scss', OUTPUT).options({postCss: [require('postcss-rtl')()]});
}

/*
 |--------------------------------------------------------------------------
 | App
 | @package app
 |--------------------------------------------------------------------------
 */
if (MIX_PACKAGE === 'app') {
       // JS
       // generates public/assets/app/app.js
       mix.js('resources/assets/js/app.js', OUTPUT).extract([
           'jquery',
           'nprogress',
           'swiper',
           
       ]);
   
       // CSS
       // generates public/assets/app/app.css
        mix.styles([
           output('bootstrap') + 'bootstrap.css',
           NPM + 'swiper/dist/css/swiper.min.css',
           
       ], OUTPUT + 'app.css');
}

☂️Common Issues

Reload watcher when webpack.mix.js file is udpdated
See #1

💡 Former & Related projects

🗝 License

The MIT License (MIT) - Copyright (c) 2017 Fandogh - Pooya Parsa