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

@dsktschy/laravel-mix-pug

v1.0.0

Published

Laravel Mix Plugin for compiling Pug/Jade templates.

Downloads

2

Readme

laravel-mix-pug

Laravel Mix Plugin for compiling Pug/Jade templates.

Introduction

This package provides a plugin for Laravel Mix to compile pug templates. @dsktschy/laravel-mix-pug requires Laravel Mix to work. Please follow the instructions on how to use it on the package repository.

Usage

Install this package into your project:

npm install @dsktschy/laravel-mix-pug --save-dev

Head over to your webpack.mix.js and register it on the Laravel Mix API:

let mix = require('laravel-mix');
mix.pug = require('@dsktschy/laravel-mix-pug');

mix.js('src/app.js', 'dist')
   .sass('src/app.scss', 'dist')
   .pug('src/*.pug', 'dist')
   .setPublicPath('dist');

Options

You can also pass in a third optional parameter: options object. It accepts two options:

seeds

This is a path to a folder with seed files. Files can be of type json or yaml. They will be parsed and provided in your pug template locals under the seed file name and then contents.

mix.pug('src/*.pug', 'dist', {seeds:'src/seeds'});

And if you have a file demo.yml in there all the content will be available in your template under

a(href=seed.demo.anchor.link) seed.demo.anchor.name

locals

It's possible to pass in an object which will be added to locals in your pug templates:

mix.pug('src/*.pug', 'dist', {
    locals: {
        config: { baseUrl: 'http://my-template.dev/' }
    }
});

and in your pug file:

link(rel="stylesheet" media="screen" href=`{config.baseUrl}css/app.css`)
script(src=`{config.baseUrl}js/main.js`)

pug

You can pass in pug config options under pug key:

mix.pug('src/*.pug', 'dist', {
    pug: {
        pretty: true,
        debug: true
    }
});

ext && excludePath

It is possible to change to output file extension and exlude part of the path. i.e.: You want your destination file to be in resources/assets/views and the folder structure in there to continue from the resources/assets/pug/{..}:

mix.pug('resources/assets/pug/*.pug', 'resources/assets/views', {
    ext: '.blade.php',
    exludePath: 'resources/assets/pug'
});

License

Laravel Mix Pug is open-sourced software licensed under the MIT license.