ideil / laravel-mix-twig Goto Github PK
View Code? Open in Web Editor NEWLaravel Mix extension that generates HTML from Twig templates
License: MIT License
Laravel Mix extension that generates HTML from Twig templates
License: MIT License
Great plugin! You have to share it on https://laravel-mix.com/extensions I found it by casualty π
Watch doesn't seem to be triggered when a new .twig
file is created.
Currently, my Twig gets compiled to HTML correctly π
Magically, the JS is linked in the header, but the path is incorrect. π
I get Failed to load resource: net::ERR_NAME_NOT_RESOLVED
as the path //app.js
gets resolved to http://app.js
which is not valid.
Here is my mix.config.js
// webpack.mix.js
let mix = require("laravel-mix");
require("laravel-mix-twig");
mix
.twig({
enabled: !mix.inProduction(),
root: "src/views/",
output: ".",
})
.js("src/js/app.js", "dist")
.browserSync({
server: "dist",
})
.setPublicPath("dist");
I'm getting the following error when changing the output
config setting.
[webpack-cli] TypeError: Cannot read property 'length' of undefined
at /Users/kylebrumm/projects/laravel-mix-with-twig/node_modules/laravel-mix-twig/src/index.js:146:55
at Array.forEach (<anonymous>)
at makeHtmlConfig (/Users/kylebrumm/projects/laravel-mix-with-twig/node_modules/laravel-mix-twig/src/index.js:138:25)
at Twig.webpackPlugins (/Users/kylebrumm/projects/laravel-mix-with-twig/node_modules/laravel-mix-twig/src/index.js:165:13)
at ComponentRegistrar.applyPlugins (/Users/kylebrumm/projects/laravel-mix-with-twig/node_modules/laravel-mix/src/components/ComponentRegistrar.js:203:23)
at /Users/kylebrumm/projects/laravel-mix-with-twig/node_modules/laravel-mix/src/components/ComponentRegistrar.js:102:50
at /Users/kylebrumm/projects/laravel-mix-with-twig/node_modules/laravel-mix/src/Dispatcher.js:37:62
at Array.map (<anonymous>)
at Dispatcher.fire (/Users/kylebrumm/projects/laravel-mix-with-twig/node_modules/laravel-mix/src/Dispatcher.js:37:47)
at Mix.dispatch (/Users/kylebrumm/projects/laravel-mix-with-twig/node_modules/laravel-mix/src/Mix.js:240:32)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.