Guest User

Untitled

a guest
Feb 21st, 2018
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. //webpack.config.js
  2.  
  3. var webpack = require('webpack');
  4. var GoogleFontsPlugin = require("google-fonts-webpack-plugin");
  5.  
  6. // exports the node module
  7. module.exports = function(env) {
  8. 'use strict';
  9.  
  10. return {
  11. entry: "./js/app.js",
  12. output: {
  13. path: __dirname + "/dist",
  14. filename: "bundle.js"
  15. },
  16.  
  17. /* ... */
  18. plugins: [
  19. new GoogleFontsPlugin({
  20. fonts: [
  21.  
  22. { family: "Source Sans Pro" },
  23. { family: "Raleway", variants: [ "400", "600","900", "700italic", "Regular", "Medium","Bold","Extra-Bold", "Black"] }
  24. ]
  25.  
  26. /* ...options */
  27. })
  28. ],
  29.  
  30. module: {
  31. loaders: [
  32. {
  33. test: /\.html$/,
  34. loader: 'raw-loader',
  35. exclude: /node_modules/
  36. },
  37. {
  38. test : /\.css$/,
  39. loaders: ['style-loader', 'css-loader', 'resolve-url-loader', "postcss-loader"]
  40. }, {
  41. test : /\.scss$/,
  42. loaders: ['style-loader', 'css-loader', 'resolve-url-loader', 'sass-loader?sourceMap']
  43. },
  44. {
  45. test: /\.woff($|\?)|\.woff2($|\?)|\.ttf($|\?)|\.eot($|\?)|\.svg($|\?)/,
  46. loader: 'url-loader'
  47. },
  48. // the url-loader uses DataUrls.
  49. // the file-loader emits files.
  50. {
  51. test: /\.woff2?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
  52. // Limiting the size of the woff fonts breaks font-awesome ONLY for the extract text plugin
  53. // loader: "url?limit=10000"
  54. use: "url-loader"
  55. },
  56. {
  57. test: /\.(ttf|eot|svg)(\?[\s\S]+)?$/,
  58. use: 'file-loader'
  59. },
  60. {
  61. // I want to uglify with mangling only app files, not thirdparty libs
  62. test: /.*\/app\/.*\.js$/,
  63. exclude: /.spec.js/, // excluding .spec files
  64. loader: "uglify"
  65. },
  66. {
  67. test: /\.(gif|png|jpe?g|svg)$/i,
  68. loaders: [
  69. 'file-loader', {
  70. loader: 'image-webpack-loader',
  71. options: {
  72. gifsicle: {
  73. interlaced: false
  74. },
  75. optipng: {
  76. optimizationLevel: 7
  77. },
  78. pngquant: {
  79. quality: '65-90',
  80. speed: 4
  81. },
  82. mozjpeg: {
  83. progressive: true,
  84. quality: 65
  85. },
  86. // Specifying webp here will create a WEBP version of your JPG/PNG images
  87. webp: {
  88. quality: 75
  89. }
  90. }
  91. }
  92. ]
  93. }
  94. ]
  95.  
  96. }
  97. }
  98. }
Add Comment
Please, Sign In to add comment