https://github.com/lasso-js/gulp-lasso
Gulp plugin to support Lasso.js
https://github.com/lasso-js/gulp-lasso
Last synced: 7 months ago
JSON representation
Gulp plugin to support Lasso.js
- Host: GitHub
- URL: https://github.com/lasso-js/gulp-lasso
- Owner: lasso-js
- Created: 2014-09-26T14:16:39.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-06-07T18:42:31.000Z (over 9 years ago)
- Last Synced: 2025-04-17T22:46:54.423Z (7 months ago)
- Language: JavaScript
- Homepage: http://raptorjs.org/
- Size: 13.7 KB
- Stars: 4
- Watchers: 5
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gulp-lasso
Gulp plugin for [Lasso.js](https://github.com/lasso-js/lasso).
Replaces references to scripts or stylesheets into a set of HTML files.
## Usage
First, install `gulp-lasso` as a development dependency:
```shell
npm install --save-dev gulp-lasso
```
Then, add it to your `gulpfile.js`:
```javascript
var lasso = require('gulp-lasso');
gulp.task('lasso', function(){
gulp.src(['src/**/*.html'])
.pipe(lasso({
"configFile": "./lasso-config.json", //Path to a JSON lasso configuration file
"dependencies": [
"./src/css/style.css",
"./src/css/style.less",
"./js/libs/react/react.js",
"./src/jsx/main.jsx",
"require-run: ./src/js/main"
],
"plugins": [
"lasso-less",
"lasso-jsx"
],
"mode": 'production'
}))
.pipe(gulp.dest('build'));
});
```
Create the lasso config file:
__lasso-config.json:__
```javascript
{
"plugins": [], // plugins can be specified here, or can be overridden in the gulpfile.js
"fileWriter": {
"outputDir": "build/static",
"fingerprintsEnabled": false,
"urlPrefix": "static/"
},
"minify": true,
"resolveCssUrls": true,
"bundlingEnabled": true
}
```
Create the main Node.js JavaScript module file:
__main.js:__
```javascript
var changeCase = require('change-case');
console.log(changeCase.titleCase('hello world')); // Output: 'Hello World'
```
Create a StyleSheet for the page:
__style.css__
```css
body {
background-color: #5B83AD;
}
```
Sample file under ```src/``` eg: ```src/index.html```
__src/index.html:__
```html
Lasso.js Demo
Lasso.js Demo
```
Run the following command to generate the concatenated, minifed css, js files inside static folder and references of those files are added into the html files:
```bash
gulp lasso
```
This should generate the html file in ```build/```
__build/index.html:__
```html
Lasso.js Demo
Lasso.js Demo
$rmod.ready();
```