A modular web development project with LESS preprocessing and a component-based structure.
NGL/
├── package.json # Dependencies and scripts
├── src/ # Source files
│ └── less/ # LESS stylesheets
│ ├── style.less # Main LESS entry point
│ ├── variables.less # Global variables and media queries
│ ├── mixins.less # LESS mixins and utilities
│ └── reset.less # CSS reset/normalize
├── modules/ # Reusable modules
│ ├── hero/ # Hero section module
│ │ ├── tpl.html # HTML template
│ │ ├── style.less # Module styles
│ │ └── script.js # Module JavaScript
│ └── footer/ # Footer module
│ ├── tpl.html # HTML template
│ └── style.less # Module styles
├── pages/ # Page templates
│ └── home/ # Home page
│ ├── index.html # Main page file
│ └── script.js # Page-specific JavaScript
├── assets/ # Static assets
│ └── images/ # Image files
└── dist/ # Compiled/build files
└── css/ # Compiled CSS
npm installStart the development server with live reloading and LESS compilation:
npm run devThis will:
- Start a live server on
http://localhost:3000 - Watch for LESS file changes and auto-compile
- Open the home page automatically
To manually compile LESS files:
# Compile to development CSS
npm run build-less
# Compile to compressed/minified CSS
npm run build-less-compressed
# Build both versions
npm run buildnpm run dev- Start development server with live reload and LESS watchingnpm run serve- Start live server onlynpm run watch-less- Watch LESS files for changesnpm run build-less- Compile LESS to CSSnpm run build-less-compressed- Compile LESS to minified CSSnpm run build- Build both development and production CSS
- Create a new directory in
modules/ - Add the following files:
tpl.html- HTML templatestyle.less- Module stylesscript.js- Module JavaScript (optional)
- Import the styles in
src/less/style.less:@import "../../modules/your-module/style";
Key variables available globally: