Generating CSS
Prerequisites
Before diving in, ensure you have the required dependencies installed.
Navigate to the web/tailwind
directory within your Hyvä theme:
Then, run the following command:
Minimal Node.js version requirements per Hyvä version
For optimal performance, we recommend using the Node.js LTS version or later. Hyvä releases have different minimum Node.js requirements due to dependencies:
- Hyvä 1.3.6: Node.js 16
- Hyvä 1.2.0: Node.js 14
- Hyvä 1.1.0: Node.js 12.13
Building for Production
Generate optimized stylesheets for production use with this command:
Alias:
npm run build-prod
(same above, including a success message)
Building for Development
While developing, use this command to start a watch process:
This continuously monitors your templates for Tailwind CSS classes mentioned in the purge configuration.
Any changes are automatically reflected in the styles.css
file, streamlining development.
Learn More: For in-depth information on controlling file size with Tailwind CSS and PurgeCSS, refer to the official documentation: https://v3.tailwindcss.com/docs/controlling-file-size#purge-css-options
Additional NPM Commands
browser-sync
For detailed instructions on using browser-sync, refer to the dedicated documentation Using browser-sync.
Replace http://your-magento.test
with your actual Magento development URL.
For more advanced options, explore the documentation provided in the Using browser-sync or visit the official browser-sync documentation.
Deprecated Commands
The following NPM commands are no longer available or discouraged:
npm run build-dev
(Deprecated in Hyvä 1.2.0): This command was used before Tailwind's JIT mode to generate a development CSS build without watch functionality. It's been removed and will only display a message informing you of its deprecation.