/**
 * @author Bilal Cinarli
 */

'use strict';

const path            = require('path');
const pkg             = require('./package.json');
let ExtractTextPlugin = require('extract-text-webpack-plugin');

const config = {};

config.name = pkg.name;

config.source = path.resolve(__dirname, 'source');

config.paths = {
    app:     path.resolve(__dirname, 'app'),
    public:  '/',
    content: './app/',
    assets:  './assets/',
    scripts: './assets/scripts/',
    styles:  './assets/styles/',
    images:  './assets/images/',
    fonts:   './assets/fonts/'
};

config.relativePaths = {
    fonts:  '../fonts/',
    images: '../images/'
};

config.filenames = {
    js:  config.paths.scripts + config.name + '.[name]',
    lib: config.paths.scripts + config.name + '.lib.js',
    css: config.paths.styles + config.name + '.css'
};

config.libs = [];

Object.keys(pkg.dependencies).forEach(item => {
    return config.libs.push(item);
});

config.extractCSS = new ExtractTextPlugin(config.filenames.css);

config.rules = {
    fontUrl:  {
        test:    /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
        loader:  'url-loader',
        options: {
            name:       '[name].[ext]',
            limit:      5000,
            mimetype:   'application/font-woff',
            outputPath: config.paths.fonts,
            publicPath: config.relativePaths.fonts
        }
    },
    fontFile: {
        test:    /\.ttf$|\.eot$/,
        loader:  'file-loader',
        options: {
            name:       '[name].[ext]',
            outputPath: config.paths.fonts,
            publicPath: config.relativePaths.fonts
        }
    },
    images:   {
        test: /.*\.(gif|png|jpe?g|svg)$/i,
        use:  [
            {
                loader: 'file-loader',
                query:  {
                    name:       '[name].[ext]',
                    outputPath: config.paths.images,
                    publicPath: config.relativePaths.images
                }
            },
            {
                loader: 'image-webpack-loader',
                query:  {
                    progressive:       true,
                    optimizationLevel: 7,
                    interlaced:        false,
                    pngquant:          {
                        quality: '65-90',
                        speed:   4
                    }
                }
            }
        ]
    },
    html:     {
        test:    /\.tpl?$/i,
        loader:  'html-loader',
        options: {
            attrs: ["img:src", "link:href"]
        }
    },
    eslint:   {
        test:    /\.(js|jsx)?$/i,
        enforce: 'pre',
        loader:  'eslint-loader'
    },
    babel:    {
        test:   /\.(js|jsx)?$/i,
        loader: 'babel-loader'
    },
    extract:  {
        test:   /\.scss?$/i,
        loader: config.extractCSS.extract({
            loader: [
                {loader: 'css-loader', query: {sourceMap: true}},
                {loader: 'resolve-url-loader', query: {keepQuery: true}},
                {loader: 'sass-loader', query: {sourceMap: true}}
            ]
        })
    }
};

module.exports = config;
@@ -1016,24 +1016,166 @@
 g.rules = %7B%0A
+    inlineFont: %7B%0A        test:   /%5C.(gif%7Cpng%7Cjpe?g%7Csvg%7Cwoff(2)?%7Ceot%7Cttf)(%5C?%5Ba-z0-9=.%5D+)?$/,%0A        loader: 'url-loader?limit=100000'%0A    %7D,%0A
     fontUrl:
@@ -1174,16 +1174,18 @@
 fontUrl:
+  
   %7B%0A    
@@ -1532,16 +1532,18 @@
 ontFile:
+  
  %7B%0A     
@@ -1784,24 +1784,26 @@
   images:   
+  
 %7B%0A        te
@@ -2544,24 +2544,26 @@
   html:     
+  
 %7B%0A        te
@@ -2703,24 +2703,26 @@
   eslint:   
+  
 %7B%0A        te
@@ -2819,24 +2819,26 @@
   babel:    
+  
 %7B%0A        te
@@ -2894,24 +2894,330 @@
 der'%0A    %7D,%0A
+    sass:       %7B%0A        test:    /%5C.scss?$/i,%0A        loaders: %5B%0A            'style-loader',%0A            %7Bloader: 'css-loader', query: %7BsourceMap: true%7D%7D,%0A            %7Bloader: 'resolve-url-loader', query: %7BkeepQuery: true%7D%7D,%0A            %7Bloader: 'sass-loader', query: %7BsourceMap: true%7D%7D%0A        %5D%0A    %7D,%0A
     extract:
@@ -3216,16 +3216,18 @@
 extract:
+  
   %7B%0A    
@@ -3558,16 +3558,16 @@
   %7D%0A%7D;%0A%0A
-
 module.e
@@ -3582,8 +3582,9 @@
  config;
+%0A

Update app.config.js