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

laravel-mix-edge

v0.2.0

Published

Laravel Mix Plugin for compiling Edge templates.

Downloads

3

Readme

laravel-mix-edge

Laravel Mix Plugin for compiling Edge templates.

Introduction

This package provides a plugin for Laravel Mix to compile Edge templates. laravel-mix-edge 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 laravel-mix-edge --save-dev

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

let mix = require('laravel-mix');
require('laravel-mix-edge');

mix.js('src/app.js', 'dist')
   .sass('src/app.scss', 'dist')
   .edge('src/views', '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 Edge template locals under the seed file name and then contents.

mix.edge('src/views', '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="{{ demo.anchor.link }}">
    {{ demo.anchor.name }}
</a>

locals

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

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

and in your edge file:

<link rel="stylesheet" href="{{ config.baseUrl }}css/main.css">
<script src="{{ config.baseUrl }}js/main.js"></script>

outputExtension && sourceExtension

It is possible to change to output file and source file extension.

mix.edge('src/views', 'dist', {
  sourceExtension: '.edge.html',
  outputExtension: '.blade.php',
});

edge

It is possible to set options to Edge library.

mix.edge('src/views', 'dist', {}, {
  edge: {}
});

global

Globals are key/value pairs available to all of your templates. Edge ships with a bunch of commonly used globals. Also, you can add your own globals to the edge instance. More info

mix.edge('src/views', 'dist', {}, {
  global: {
    'json': data => JSON.stringify(data),
  }
});

presenters

View Presenter is a way to encapsulate complex logic inside a dedicated class, instead of writing it inside your template files. Also, it is very important to understand the philosophy behind a Presenter before you can really empower it. More info

mix.edge('src/views', 'dist', {
  presenters: 'src/presenters'
});

License

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