figlet-loader
Get your figlet build bundled with webpack.
Install
$ npm install figlet-loader --save-dev
Usage
There are three use case.
- Using loader
options
.
IMPORTANT: add type: "javascript/auto"
if you using webpack@4
and JSON
sytax for config.
; // or `const content = require('figlet');` console;
webpack.config.js
moduleexports = module: rules: loader: "figlet-loader" // ONLY FOR `webpack@4` and `JSON` config type: "javascript/auto" options: fontOptions: // Full list of supported options and their description can be found in [figlet](https://github.com/patorjk/figlet.js). font: "ANSI Shadow" horizontalLayout: "default" kerning: "default" verticalLayout: "default" textBefore: "TEXT BEFORE" text: "ANOTHER-TEXT" textAfter: "TEXT AFTER" test: /empty-alias-file\.js$/ resolve: alias: // You can add comment "Please do not delete this file" in this file figlet$: path ;
- Using config file through alias (supported JavaScript and JSON syntax).
IMPORTANT: add type: "javascript/auto"
if you using webpack@4
and JSON
sytax for config.
; // or `const content = require('figlet');` console;
.figletrc.js
"use strict"; moduleexports = fontOptions: font: "ANSI Shadow" horizontalLayout: "default" kerning: "default" verticalLayout: "default" textBefore: "TEXT BEFORE" text: "ANOTHER-TEXT-JS-RC" textAfter: "TEXT AFTER";
webpack.config.js
moduleexports = module: rules: loader: "figlet-loader" // ONLY FOR `webpack@4` and `JSON` config type: "javascript/auto" test: /\.figletrc\.js$/ resolve: alias: figlet$: path ;
- Using config (supported JavaScript and JSON syntax) file directly (see below example how it is use).
IMPORTANT: add type: "javascript/auto"
if you using webpack@4
and JSON
sytax for config.
; console;
webpack.config.js
moduleexports = module: rules: loader: "figlet-loader" // ONLY FOR `webpack@4` and `JSON` config type: "javascript/auto" test: /\.figletrc\.js$/ ;
Additional Usage
Async loading:
- Using
webpack
dynamicimport
.
import"figlet";
- You can used bundle plugin for async loading:
; ;
Related
- figlet - API for this module
Contribution
Feel free to push your code if you agree with publishing under the MIT license.