Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //webpack.config.js
- var webpack = require('webpack');
- var GoogleFontsPlugin = require("google-fonts-webpack-plugin");
- // exports the node module
- module.exports = function(env) {
- 'use strict';
- return {
- entry: "./js/app.js",
- output: {
- path: __dirname + "/dist",
- filename: "bundle.js"
- },
- /* ... */
- plugins: [
- new GoogleFontsPlugin({
- fonts: [
- { family: "Source Sans Pro" },
- { family: "Raleway", variants: [ "400", "600","900", "700italic", "Regular", "Medium","Bold","Extra-Bold", "Black"] }
- ]
- /* ...options */
- })
- ],
- module: {
- loaders: [
- {
- test: /\.html$/,
- loader: 'raw-loader',
- exclude: /node_modules/
- },
- {
- test : /\.css$/,
- loaders: ['style-loader', 'css-loader', 'resolve-url-loader', "postcss-loader"]
- }, {
- test : /\.scss$/,
- loaders: ['style-loader', 'css-loader', 'resolve-url-loader', 'sass-loader?sourceMap']
- },
- {
- test: /\.woff($|\?)|\.woff2($|\?)|\.ttf($|\?)|\.eot($|\?)|\.svg($|\?)/,
- loader: 'url-loader'
- },
- // the url-loader uses DataUrls.
- // the file-loader emits files.
- {
- test: /\.woff2?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
- // Limiting the size of the woff fonts breaks font-awesome ONLY for the extract text plugin
- // loader: "url?limit=10000"
- use: "url-loader"
- },
- {
- test: /\.(ttf|eot|svg)(\?[\s\S]+)?$/,
- use: 'file-loader'
- },
- {
- // I want to uglify with mangling only app files, not thirdparty libs
- test: /.*\/app\/.*\.js$/,
- exclude: /.spec.js/, // excluding .spec files
- loader: "uglify"
- },
- {
- test: /\.(gif|png|jpe?g|svg)$/i,
- loaders: [
- 'file-loader', {
- loader: 'image-webpack-loader',
- options: {
- gifsicle: {
- interlaced: false
- },
- optipng: {
- optimizationLevel: 7
- },
- pngquant: {
- quality: '65-90',
- speed: 4
- },
- mozjpeg: {
- progressive: true,
- quality: 65
- },
- // Specifying webp here will create a WEBP version of your JPG/PNG images
- webp: {
- quality: 75
- }
- }
- }
- ]
- }
- ]
- }
- }
- }
Add Comment
Please, Sign In to add comment