# assemble-webpack-new

> Webpack Loader + Plugin for Assemble.io handlebar compilation

Latest version **1.0.0** (published 2020-11-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install assemble-webpack-new
pnpm add assemble-webpack-new
yarn add assemble-webpack-new
bun add assemble-webpack-new
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-11-02 |
| First published | 2020-11-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Ravi Roshan |
| Maintainers | nmulakaluri |

## Links

- npm: https://www.npmjs.com/package/assemble-webpack-new
- Repository: https://github.com/raviroshan/assemble-webpack
- Homepage: https://github.com/raviroshan/assemble-webpack#readme
- Issues: https://github.com/raviroshan/assemble-webpack/issues
- npm.io page: https://npm.io/package/assemble-webpack-new

## Dependencies (4)

- [chalk](https://npm.io/package/chalk.md) ^2.4.1
- [assemble](https://npm.io/package/assemble.md) ^0.24.3
- [gulp-extname](https://npm.io/package/gulp-extname.md) ^0.2.2
- [gulp-plumber](https://npm.io/package/gulp-plumber.md) ^1.2.1

## Recent versions

- 1.0.0 (latest) — 2020-11-02

## README

# 🔩 🛠 assemble-webpack
Thanks to Ravi Roshan for building this loader. I had to fork this repo to add more features to it.

Webpack Loader + Plugin for compiling Handlebars using Assemble.io

Generates HTML pages using Handlebars templating and Assemble's power.

# Install

`npm install --save-dev assemble-webpack`

# Usage

```js
const assembleWebpack = require('assemble-webpack');
const handlebarsHelpers = require('handlebars-helpers');

module.exports = {
  // webpack configurations
  module: {
    rules: [
      {
        test: /\.(hbs)$/,
        use: [
          {
            loader: 'assemble-webpack'
          }
        ]
      }
    ]
  },

  plugins: [
    new assembleWebpack.AttachedPlugin({
      baseLayout: ['./src/app/layouts/**/*.hbs'],
      basePages: ['./src/app/pages/**/*.hbs'],
      partialsLayout: ['./src/app/fe-components/**/*.hbs'],
      partialsData: [
        './src/app/fe-components/**/*.json',
        './src/app/layouts/**/*.json',
        './src/app/pages/**/*.json'
      ],
      helpers: [handlebarsHelpers(), './src/app/helpers/custom-helpers.js']
    })
  ]
};
```

# Configuration Options & Details

|      Name      | Type  | Description                                                                                                                |
| :------------: | ----- | -------------------------------------------------------------------------------------------------------------------------- |
|   baseLayout   | array | Relative path of Base Layout files considered as Main template. It acts as HTML skeleton and used by the actual basePages. |
|   basePages    | array | Relative path of Base Pages. These will generate the Actual HTML files as an output                                        |
| partialsLayout | array | Relative path of HBS partials. These are smaller re-usable components and can used inside another components or pages      |
|  partialsData  | array | Relative path of JSON data which will be interpolated in HBS components.                                                   |
|    helpers     | array | Relative path of custom helpers files                                                                                      |

# Important Points

- `assembleWebpack` is used as a plugin to provide the required configurations and to compile handlebar files using assembler.io during Webpack build.
- We also need `assemble-webpack` as a loader to compile Handlebars files with extension `hbs`

**Note**: Until you link the required resources in your project's dependency graph, Webpack will NOT be able to track it for any changes during `Watch` mode or while running `Webpack-dev-server`.

So even though `assembleWebpack` plugin generates the output during Webpack build, you still need to explicitly `import/require` the Handlebar resources somewhere in your project so that it can be re-compiled on the respective file changes.

# Credits

The repo is forked from https://github.com/raviroshan/assemble-webpack 

# Demo/Example

You can refer https://github.com/raviroshan/assemble-webpack-demo

---
_Source: https://npm.io/package/assemble-webpack-new · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
