Installation and Usage
Although the installation and usage instructions given in the general README are suitable for most use cases, there might be some situations in which you might prefer the alternative methods explained in here.
Installation
Locally
In most cases you'll want to include LintHTML as part of your project's build system. To do so, you can install LintHTML either with npm
:
npm install @linthtml/linthtml --save-dev
...or with yarn
:
yarn add @linthtml/linthtml --dev
And initialize a LintHTML configuration file (.linthtmlrc
) either with npx
:
npx linthtml --init
...or executing directly LintHTML's bin:
./node_modules/.bin/linthtml --init
Globally
If you want to make LintHTML available to tools that run across all of your projects, you might prefer to install LintHTML globally, which can be achieved either with npm
:
npm install -g @linthtml/linthtml
...or with yarn
:
yarn global add @linthtml/linthtml
And initialize a LintHTML configuration file (.linthtmlrc
) running:
linthtml --init
Usage
You can run LintHTML on any file like this with npx
:
npx linthtml 'yourfile.html'
If you installed LintHTML locally you might prefer to specify the full path of the bin:
./node_modules/.bin/linthtml 'yourfile.html'
Whereas if you installed it globally, running it this way should be enough:
linthtml 'yourfile.html'
Running LintHTML on all the HTML files in the certain directory/project must be one of the most common use cases. For example, if all your code is located inside a src/
folder, you can run:
npx linthtml 'src/**/*.html'