Script & Build Process

Linting and Minifying

With the move to blocks, ID has deprecated grunt in favor of running npm script commands:

npm run:

  • start: Compiles the styles and scripts from src to build folders without minifying for development and troubleshooting. This script will run continuously to recompile during development.
  • build: Like start, this also compiles styles and scripts, however this command minifies and optimizes for production use. This script runs once and exits when complete.
    The build command runs the below sub-commands:
    • clean: Delete existing language files
    • wpi18n: Updates the text domain in php files
    • wpmakepot: Builds the language .pot file
    • i18n: Runs the above three commands
    • scripts: Runs the wp build command
    • version: Updates the version from package.json to variables and constants in the code.
  • new-id-block: Pulls in the skeleton of a new block based on the BU block template.
  • new-wp-block: Pulls in the skeleton of the WordPress default block.
  • format: Cleans up the code based on the WordPress JavaScript coding standards
  • lint: The lint command will check your code for errors and formatting corrections. The primary lint command will run the following sub-commands:
    • css: Checks sass files based on stylelint
    • html: Checks html files
    • js: Checks JavaScript, based on eslint
    • js:fix: Same as above, but will also fix possible formatting errors
    • md: Checks markdown files using markdownlint
    • php: Bash script running PHP Code Sniffer and Beautifier on changed php files not committed to the repo.
    • php:all: Same bash script but checks all php files.
    • pkg: Linting for package.json