All Projects β†’ ben-rogerson β†’ Agency Webpack Mix Config

ben-rogerson / Agency Webpack Mix Config

πŸ‘¨β€πŸ’» A capable website/webapp boilerplate ready for the web agency battlefield. Creates a static site with Twig templating by default. Supports Craft/Wordpress/Laravel after a few adjustments.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Agency Webpack Mix Config

Gulp Webpack Starter
Gulp Webpack Starter - fast static website builder. The starter uses gulp toolkit and webpack bundler. Download to get an awesome development experience!
Stars: ✭ 199 (+139.76%)
Mutual labels:  webpack-configuration, static-site-generator
Baumeister
πŸ‘· The aim of this project is to help you to build your things. From Bootstrap themes over static websites to single page applications.
Stars: ✭ 171 (+106.02%)
Mutual labels:  webpack-configuration, static-site-generator
Hugofy Sublime
Hugo plugin for Sublime Text 3
Stars: ✭ 64 (-22.89%)
Mutual labels:  static-site-generator
Awesome Blogdown
An awesome curated list of blogs built using blogdown
Stars: ✭ 80 (-3.61%)
Mutual labels:  static-site-generator
Angular Cli Webpack
Webpack configuration modifier for @angular/cli
Stars: ✭ 72 (-13.25%)
Mutual labels:  webpack-configuration
Jekyll Vue Template
A starter template for Jekyll projects with Vue.js and Vue Single File Components, complete with webpack.
Stars: ✭ 65 (-21.69%)
Mutual labels:  static-site-generator
Flybook
✈️ FlyBook is a simple utility to generate static website such as gh-pages, manual of you projects
Stars: ✭ 76 (-8.43%)
Mutual labels:  static-site-generator
Gojekyll
A fast clone of the Jekyll blogging engine, in Go
Stars: ✭ 62 (-25.3%)
Mutual labels:  static-site-generator
Hydrogen
🎈 Hydrogen. Voted (by me) the world's lightest static-site generator built with TypeScript ❀ It uses πŸ”₯ lit-html inspired templating for super duper performant template generation.
Stars: ✭ 80 (-3.61%)
Mutual labels:  static-site-generator
Hugo Steam Theme
Port of Tommaso Barbato's Ghost theme Steam to Hugo
Stars: ✭ 69 (-16.87%)
Mutual labels:  static-site-generator
Meilidu Hexo
MeiliDu, beatuiful reading theme for Hexo.
Stars: ✭ 78 (-6.02%)
Mutual labels:  static-site-generator
Hepek
Web content generators in Scala. Intuitive, scalable, powerful.
Stars: ✭ 69 (-16.87%)
Mutual labels:  static-site-generator
Vscode Ts Webpack Node Debug Example
VSCode TypeScript Webpack Node Debug Example
Stars: ✭ 66 (-20.48%)
Mutual labels:  webpack-configuration
Tumblelog
A static tumblelog generator available as both a Perl and Python version
Stars: ✭ 77 (-7.23%)
Mutual labels:  static-site-generator
Makebakery
A static website generator built on GNU Make.
Stars: ✭ 64 (-22.89%)
Mutual labels:  static-site-generator
Heckle
βœ’οΈ Jekyll in Haskell (feat. LaTeX)
Stars: ✭ 80 (-3.61%)
Mutual labels:  static-site-generator
Cactus
🌡A composable static site generator
Stars: ✭ 63 (-24.1%)
Mutual labels:  static-site-generator
Yohe
😈 powerful static blog generator
Stars: ✭ 68 (-18.07%)
Mutual labels:  static-site-generator
Glim
Static site generator which is semi-compatible with Jekyll
Stars: ✭ 76 (-8.43%)
Mutual labels:  static-site-generator
Dumi
πŸ“– Documentation Generator of React Component
Stars: ✭ 1,232 (+1384.34%)
Mutual labels:  static-site-generator

Agency Webpack Mix Config

Icon

Featuring a top-class developer experience and simple filing system for your project assets, this config provides a solid platform for your next website (or web app).

Features

Sensible configuration complexity

Because of the complexity of raw Webpack configs, they can take an extended time to understand. Laravel Mix provides a simple layer upon Webpack to help make many build adjustments quick and painless.

Modern mainstream defaults

Use next generation JavaScript and CSS with polyfills automatically applied to the browsers you choose to support.

Development proxy with script and style injection

A pre-configured webpack development server rewards your code changes with snappy browser updates. Generate additional style and script outputs just by adding them to a folder in the src directory.

Static site generator

Get straight to the build with a static site generator that converts twig to html.
There's also full support for CMS based sites by updating a few config values.

Minimal config files

Avoid excessive build configuration files with all config defined in webpack.mix.js.
The package.json contains browser targets and linting configs.

Build actions

src/styles

Style files are compiled to CSS and PostCss plugins provide additional transformations and optimisations.

Styles src folder


src/scripts

Script files are transpiled to vanilla JavaScript and the necessary polyfills included.

Script src folder

  • Script transpiling with Babel with minifying and sourcemaps
  • Automatic browser polyfills are provided by Core-Js 3
  • ESLint is provided for error linting

src/images

Images are optimized and copied to the build directory.

Image src folder

  • Optimisations are provided by Imagemin

src/icons

Individual SVG icons are optimised then combined into a single cacheable SVG.

Icons src folder

  • An async script adds the svg sprite to your page
  • You can display an icon like this:
<svg><use xlink:href="icon-code" /></svg>

src/static

Additional folders with no transform requirements are copied to your build folders.

Static src folder


Getting started

1. Copy this repo into a new project folder:

npx degit ben-rogerson/agency-webpack-mix-config new-project

…or use Github's new tool to create a new repository then clone the project down.

2. Install the dependencies:

cd new-project && npm install

3. Update the proxy domain and start adding project files

This config allows for either static or dynamic template sites. Dynamic template sites could be ones running Craft, Wordpress, or Laravel.

a) Create a static site

This option converts the Twig templates in src/templates into static Html files and hashes assets during a production build.

  1. Update the devProxyDomain in webpack.mix.js, eg:

    const config = {
      // ...
      devProxyDomain: "http://my-static-site.test",
    }
    
  2. Then add your devProxyDomain to Valet/Homestead/Vagrant. If you're using Valet you can add it like this:

    cd web && valet link my-static-site.test
    

    You'll need to run npm run build to preview your static site operating at my-static-site.test.

  3. npm run dev to start your development server.

b) Create a dynamic site

This option lets you use a CMS and during production it compresses and hashes assets and creates a manifest file.

You could add any CMS but in this example I'll copy in the files from the Craft CMS starter:

npx degit --force craftcms/craft

Craft CMS requires a templates directory in the base folder for their twig templates so I'll add these config values in webpack.mix.js:

const config = {
    // Dev domain to proxy
    devProxyDomain: "http://my-craft-site.test",
    // Paths to observe for changes
    devWatchPaths: ["templates"],
    // Folders where purgeCss can look for used selectors
    purgeCssGrabFolders: ["src", "templates"],
    // Build a static site from the src/template files
    buildStaticSite: false,
}

Then create a new project database, add the devProxyDomain to Valet/Homestead/Vagrant and finish the Craft install with composer install && ./craft setup.

Loading the files from the manifest

No matter what CMS you use, you'll need a way to reference the files from the mix-manifest.json file that's created. This example shows how to use Twigpack to load the files from the manifest.

Removing excess packages

There will be some unnecessary packages used only for rendering a static site. Remove them from your project:

npm rm html-webpack-plugin twig-html-loader laravel-mix-twig-to-html

Tasks

The following tasks are available:

npm run dev
# Run the development server

npm run start
# Run the development build

npm run build
# Run the production build

npm run fix-scripts
# Fix your javascript with eslint
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].