Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #Browsersync - Grunt, SASS, HTML/CSS injection example
  2. ## Installation/Usage:
  3. To try this example, follow these 4 simple steps.
  4. **Step 1**: Clone this entire repo
  5. ```bash
  6. $ git clone https://github.com/Browsersync/recipes.git bs-recipes
  7. ```
  8. **Step 2**: Move into the directory containing this example
  9. ```bash
  10. $ cd bs-recipes/recipes/grunt.html.injection
  11. ```
  12. **Step 3**: Install dependencies
  13. ```bash
  14. $ npm install
  15. ```
  16. **Step 4**: Run the example
  17. ```bash
  18. $ npm start
  19. ```
  20. ### Additional Info:
  21. To see the live HTML injecting, along with CSS injection, simply perform changes to either `index.html` or `css/main.css`
  22. ### Preview of `Gruntfile.js`:
  23. ```js
  24. // This shows a full config file!
  25. module.exports = function (grunt) {
  26. grunt.initConfig({
  27. watch: {
  28. files: 'app/scss/**/*.scss',
  29. tasks: ['bsReload:css']
  30. },
  31. sass: {
  32. dev: {
  33. files: {
  34. 'app/css/main.css': 'app/scss/main.scss'
  35. }
  36. }
  37. },
  38. browserSync: {
  39. dev: {
  40. options: {
  41. watchTask: true,
  42. server: './app',
  43. plugins: [
  44. {
  45. module: "bs-html-injector",
  46. options: {
  47. files: "./app/*.html"
  48. }
  49. }
  50. ]
  51. }
  52. }
  53. },
  54. bsReload: {
  55. css: "main.css"
  56. }
  57. });
  58. // load npm tasks
  59. grunt.loadNpmTasks('grunt-contrib-sass');
  60. grunt.loadNpmTasks('grunt-contrib-watch');
  61. grunt.loadNpmTasks('grunt-browser-sync');
  62. // define default task
  63. grunt.registerTask('default', ['browserSync', 'watch']);
  64. };
  65. ```