This commit is contained in:
tatianamac
2019-11-26 14:50:43 -08:00
parent 8a55660ed0
commit 6d5445ecc5
13894 changed files with 2233957 additions and 0 deletions

View File

@ -0,0 +1,43 @@
// This shows a full config file!
module.exports = function (grunt) {
grunt.initConfig({
watch: {
files: 'app/scss/**/*.scss',
tasks: ['bsReload:css']
},
sass: {
dev: {
files: {
'app/css/main.css': 'app/scss/main.scss'
}
}
},
browserSync: {
dev: {
options: {
watchTask: true,
server: './app',
plugins: [
{
module: "bs-html-injector",
options: {
files: "./app/*.html"
}
}
]
}
}
},
bsReload: {
css: "main.css"
}
});
// load npm tasks
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browser-sync');
// define default task
grunt.registerTask('default', ['browserSync', 'watch']);
};

View File

@ -0,0 +1,8 @@
body {
background: white;
color: black;
}
p.lede {
font-size: 2em;
}

View File

@ -0,0 +1,16 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Browsersync Grunt + HTML Injection Example</title>
<link rel='stylesheet' href='css/main.css'>
</head>
<body>
<header>
<h1>Browsersync Grunt, SASS & HTML injection Example</h1>
<p>Any changes you make to the HTML will be injected</p>
</header>
</body>
</html>

View File

@ -0,0 +1,2 @@
To see the live HTML injecting, along with CSS injection, simply perform changes to either `index.html` or `css/main.css`

View File

@ -0,0 +1,17 @@
{
"name": "bs-recipes-grunt-html-injection",
"version": "1.0.0",
"description": "Grunt, SASS, HTML/CSS injection example",
"main": "Gruntfile.js",
"scripts": {
"start": "grunt"
},
"license": "MIT",
"devDependencies": {
"bs-html-injector": "3.0.1",
"grunt": "^0.4.5",
"grunt-browser-sync": "^2.0.0",
"grunt-contrib-sass": "^0.9.2",
"grunt-contrib-watch": "^0.6.1"
}
}

View File

@ -0,0 +1,79 @@
#Browsersync - Grunt, SASS, HTML/CSS injection example
## Installation/Usage:
To try this example, follow these 4 simple steps.
**Step 1**: Clone this entire repo
```bash
$ git clone https://github.com/Browsersync/recipes.git bs-recipes
```
**Step 2**: Move into the directory containing this example
```bash
$ cd bs-recipes/recipes/grunt.html.injection
```
**Step 3**: Install dependencies
```bash
$ npm install
```
**Step 4**: Run the example
```bash
$ npm start
```
### Additional Info:
To see the live HTML injecting, along with CSS injection, simply perform changes to either `index.html` or `css/main.css`
### Preview of `Gruntfile.js`:
```js
// This shows a full config file!
module.exports = function (grunt) {
grunt.initConfig({
watch: {
files: 'app/scss/**/*.scss',
tasks: ['bsReload:css']
},
sass: {
dev: {
files: {
'app/css/main.css': 'app/scss/main.scss'
}
}
},
browserSync: {
dev: {
options: {
watchTask: true,
server: './app',
plugins: [
{
module: "bs-html-injector",
options: {
files: "./app/*.html"
}
}
]
}
}
},
bsReload: {
css: "main.css"
}
});
// load npm tasks
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browser-sync');
// define default task
grunt.registerTask('default', ['browserSync', 'watch']);
};
```