Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dulnan/drupal-webpack-setup-example

A simple webpack setup for Drupal themes, with ES6, SCSS, Hot Module Replacement.
https://github.com/dulnan/drupal-webpack-setup-example

Last synced: 3 months ago
JSON representation

A simple webpack setup for Drupal themes, with ES6, SCSS, Hot Module Replacement.

Awesome Lists containing this project

README

        

# Drupal Webpack Setup Example
This repository provides a simple example how to build JS and CSS assets with webpack for a Drupal theme.
It uses Drupal's own behavior system, supports Hot Module Replacement (HMR) and compilation of SCSS
(in local dev mode by injection from JavaScript). In production/build mode, CSS is extracted in files.

## Setup

```
npm install
```

To start the dev server, run:
```
npm run start
```

The server runs at http://localhost:9000. But if you follow the configuration in `mytheme.libraries.yml`,
you can use it via your local Drupal URL, something like mydrupalsite.local. Because we define the
webpack dev server URL as an external library in Drupal, features like Hot Module Replacement will
work.

[Webpack loader for Drupal behaviors](https://github.com/dulnan/drupal-behaviors-loader)
[Webpack plugin for Drupal.t and Drupal.formatPlural translations](https://github.com/dulnan/drupal-behaviors-loader)