Skip to main content

Django integration for Laravel Mix

Project description

Django Mix

Django integration for Laravel Mix

Laravel Mix helper in python representation to easy usage with laravel-mix npm package in Django projects.

Usage

<script src="{% mix 'app.js' 'polls/static' %}"></script>

The paths are related to webpack.mix.js configuration.

This example use following configration of webpack.mix.js:

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

let staticPath = 'polls/static'
let resourcesPath = 'polls/resources'

if (process.argv.includes('--browser-sync')) {
  mix.browserSync('localhost:8000')
}

// setResroucesRoots add prefix to url() in scss on example: from /images/close.svg?a898fb5d07d8c21381d4566b74e12d93 to /static/images/close.svg?a898fb5d07d8c21381d4566b74e12d93
mix.setResourceRoot('/static/')
mix.setPublicPath('polls/static/')

mix.js(`${resourcesPath}/js/app.js`, `${staticPath}/`)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djangomix-1.0.1.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

djangomix-1.0.1-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page