Last active
February 23, 2020 02:31
-
-
Save ben-rogerson/52936be5aef3f0c9d06f0eda33958976 to your computer and use it in GitHub Desktop.
Config for agency-webpack-mix-config and Craft Twigpack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# This is the base twig layout file #} | |
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
{{ craft.twigpack.includeCriticalCssTags() }} | |
{{ craft.twigpack.includeCssModule("/main.css") }} | |
</head> | |
<body data-icons="{{ craft.twigpack.getModuleUri("/sprite.svg") }}"> | |
{% block content %}{% endblock %} | |
{{ craft.twigpack.includeJsModule("/manifest.js") }} | |
{{ craft.twigpack.includeJsModule("/vendor.js") }} | |
{{ craft.twigpack.includeJsModule("/main.js") }} | |
{{ endBody() }} | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Place this in: config/twigpack.php | |
return [ | |
// Global settings | |
'*' => [ | |
// If `devMode` is on, use webpack-dev-server to all for HMR (hot module reloading) | |
'useDevServer' => true, | |
// Don't force fully qualified absolute URLs | |
'useAbsoluteUrl' => false, | |
// The JavaScript entry from the manifest.json to inject on Twig error pages | |
'errorEntry' => '', | |
// Manifest file names | |
'manifest' => [ | |
'legacy' => 'dist/mix-manifest.json', | |
'modern' => 'dist/mix-manifest.json', | |
], | |
// Public server config | |
'server' => [ | |
'manifestPath' => '@webroot/', | |
'publicPath' => '/dist/', | |
], | |
// webpack-dev-server config | |
'devServer' => [ | |
'manifestPath' => 'https://localhost:8080/', | |
'publicPath' => 'https://localhost:8080/', | |
], | |
// Local files config | |
'localFiles' => [ | |
'basePath' => '@webroot/', | |
'criticalPrefix' => 'dist/', | |
'criticalSuffix' => '-critical.css', | |
], | |
], | |
// Live (production) environment | |
'live' => [ | |
], | |
// Staging (pre-production) environment | |
'staging' => [ | |
], | |
// Local (development) environment | |
'local' => [ | |
// If `devMode` is on, use webpack-dev-server to all for HMR (hot module reloading) | |
'useDevServer' => true, | |
], | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Read the Twigpack docs for more info: https://nystudio107.com/plugins/twigpack/documentation