4.0.1 • Published 1 year ago

@lifterlms/scripts v4.0.1

Weekly downloads
98
License
GPL-3.0-or-later
Repository
github
Last release
1 year ago

LifterLMS Scripts

Test, build, and development scripts for LifterLMS projects.

This package is inspired by and extends functionality provided by @wordpress/scripts, adding functionality specifically for testing, building, and developing LifterLMS projects and add-ons.

Installation

Install the module

npm install --save-dev @lifterlms/scripts

CHANGELOG

CHANGELOG

Configuration Files

WordPress Blocks Webpack Configuration File

The blocks-webpack.config.js is a Webpack config file meant to build WordPress blocks found within the the project's src/blocks directory. The distribution directory is blocks/.

The config will automatically build blocks, compile SCSS to CSS, move the block.json file, and copy all PHP files for each block in the source directory.

Example Usage

Create a webpack.config.js in your project's root with the following:

const blocksConfig = require( '@lifterlms/scripts/config/blocks-webpack.config' );
module.exports = blocksConfig;

Configuration

The configuration assumes a project directory following this structure:

a-plugin/
|-- a-plugin.php
|-- assets/
|   |-- css/
|   |-- js/
|-- blocks/
|   |-- block-a/
|   |-- block-b/
|-- README.md
|-- includes/
|-- src/
|   |-- blocks/
|   |   |-- block-a/
|   |   |   |-- block.json
|   |   |   |-- index.js
|   |   |   |-- styles.scss
|   |   |-- block-b/
|   |       |-- block.json
|   |       |-- index.js
|   |       |-- index.php
|   |       |-- styles.scss
|   |-- js/
|   |-- scss/
|-- webpack.config.js

Expected filenames

The script builds scripts and styles according to definitions found in the block.json files.

editorScript - index.js
viewScript   - view.js
script       - script.js
style        - styles.scss (styles.css)
editorStyle  - editor.scss (editor.css)
*.php        - *.php

ESLint Plugin

The eslint configuration file specifies a shared set of rules for linting Javascript files across LifterLMS projects.

The configuration is a modified version of the @wordpress/eslint-plugin/recommended-with-formatting.

Example usage .eslintrc.js

const config = require( '@lifterlms/scripts/config/.eslintrc.js' );
module.exports = config;
4.0.1

1 year ago

3.2.0

2 years ago

4.0.0

2 years ago

3.1.1-alpha.0

2 years ago

3.1.0

2 years ago

2.2.0

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

2.0.0-beta.1

3 years ago

2.0.0-beta.0

3 years ago

1.3.7

3 years ago

1.3.6

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

4 years ago

1.3.0

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.3.1

4 years ago

1.2.0

4 years ago