選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #Browsersync - Server with pre-gzipped assets 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/server.gzipped.assets
  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. This example shows how you can use the `connect-gzip-static` middleware
  22. to serve already-gzipped assets.
  23. ### Preview of `app.js`:
  24. ```js
  25. /**
  26. * Require Browsersync
  27. */
  28. var browserSync = require('browser-sync').create();
  29. var middleware = require('connect-gzip-static')('./app');
  30. /**
  31. * Run Browsersync with server config
  32. * Add middleware with override:true to ensure all files are
  33. * picked up.
  34. */
  35. browserSync.init({
  36. server: 'app',
  37. files: ['app/*.html', 'app/css/*.css']
  38. }, function (err, bs) {
  39. bs.addMiddleware("*", middleware, {
  40. override: true
  41. });
  42. });
  43. ```