Socket
Book a DemoInstallSign in
Socket

laravel-mix-jigsaw

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

laravel-mix-jigsaw

Laravel Mix plugin for Jigsaw

2.1.1
latest
Source
npmnpm
Version published
Weekly downloads
391
-13.69%
Maintainers
1
Weekly downloads
 
Created
Source

Jigsaw plugin for Laravel Mix

MIT License Latest Stable Version Total Downloads

laravel-mix-jigsaw is a Laravel Mix plugin for the Jigsaw static site generator. It watches your Jigsaw site's files and triggers a new Mix build when it detects changes.

const mix = require('laravel-mix');
require('laravel-mix-jigsaw');

mix.jigsaw()
    .js('source/_assets/js/main.js', 'js')
    .css('source/_assets/css/main.css', 'css')
    .version();

Installation

npm install -D laravel-mix-jigsaw

Usage

Require the module in your webpack.mix.js file.

const mix = require('laravel-mix');
require('laravel-mix-jigsaw');

Enable the build tasks by calling .jigsaw() anywhere in your Mix build chain.

mix.js('source/_assets/js/main.js', 'js')
    .css('source/_assets/css/main.css', 'css')
    .jigsaw();

By default this plugin watches common Jigsaw file paths and triggers a new build when it detects changes. To add watched paths or override the watcher configuration, pass a config object to .jigsaw():

// Add additional file paths to watch
mix.jigsaw({
    watch: ['config.*.php'],
});

// Override the default config
mix.jigsaw({
    watch: {
        files: ['source/posts/*.blade.php'],
        notDirs: ['source/_assets/', 'source/assets/', 'source/ignore/'],
    },
});

If you use Laravel Mix's built-in BrowserSync integration, you may need to configure it to watch Jigsaw's paths:

mix.jigsaw()
    .browserSync({
        server: 'build_local',
        files: ['build_*/**'],
    });

Caveats

  • The plugin cannot detect the creation of new files immediately inside the source/ directory of your site. If you create a new file like source/home.blade.php, you'll need to stop and restart Mix.
  • With v1 of the plugin it was possible to add additional Webpack plugins/tasks that would run after the Jigsaw build but before Mix finished compiling assets. This created compatibility issues between this plugin and Mix itself, and was removed in v2. If you need to perform additional processing after your Jigsaw site is built, like minifying its HTML, you can do so using a Jigsaw event listener.

Credits

Huge thanks to Brandon Nifong for creating the initial version of this plugin!

License

Laravel Mix Jigsaw is provided under the MIT License.

Keywords

jigsaw

FAQs

Package last updated on 13 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.