Skip to content
mix.svelte();
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.styleci.yml
CHANGELOG.md
CONTRIBUTING.md
LICENSE.md
README.md
package-lock.json
package.json

README.md

Laravel Mix Svelte

A Laravel Mix extension for Svelte support.

Why?

Svelte is an interesting new approach in the JavaScript space, created by @Rich_Harris. While traditional frontend frameworks do the bulk of their work in the browser, Svelte does this in compilation step. They provide a fluid syntax for writing expressive code, but compile it down to small, framework-less vanilla JavaScript.

If you don't know what Svelte is, we highly recommend starting with Rich Harris' talk Rethinking Reactivity from YGLF Code Camp 2019, his introductory blog post or - if you're more of a hands-on type - Svelte's interactive tutorial.

This package is still in active development, so you might want to watch the repository to be notified of future changes.

Installation

You can install the package via npm or yarn:

npm install wewowweb/laravel-mix-svelte

Usage

After installing it, just require it in your webpack.mix.js file like so:

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

require('laravel-mix-svelte');

mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css')
    .svelte();

Use the options parameter example:

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

require('laravel-mix-svelte');

mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css')
    .svelte({
        dev: true
    });

For more options see the svelte-loader package: Svelte Loader

Future planned improvements

  • Add hotReload functionality
  • Add noPreserveState functionality
  • Add ExtractCss functionality for CSS
  • Add ExtractCss functionality for SASS
  • Add ExtractCss functionality for LESS
  • Add ExtractCss functionality for Stylus
  • Add tests.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email gal@wewowweb.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

You can’t perform that action at this time.