{"action":"closed","issue":{"url":"https://api.github.com/repos/webpack-contrib/extract-text-webpack-plugin/issues/213","repository_url":"https://api.github.com/repos/webpack-contrib/extract-text-webpack-plugin","labels_url":"https://api.github.com/repos/webpack-contrib/extract-text-webpack-plugin/issues/213/labels{/name}","comments_url":"https://api.github.com/repos/webpack-contrib/extract-text-webpack-plugin/issues/213/comments","events_url":"https://api.github.com/repos/webpack-contrib/extract-text-webpack-plugin/issues/213/events","html_url":"https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/213","id":165923980,"number":213,"title":"feat: support multiple publicPaths","user":{"login":"dxcqcv","id":884046,"avatar_url":"https://avatars3.githubusercontent.com/u/884046?v=4","gravatar_id":"","url":"https://api.github.com/users/dxcqcv","html_url":"https://github.com/dxcqcv","followers_url":"https://api.github.com/users/dxcqcv/followers","following_url":"https://api.github.com/users/dxcqcv/following{/other_user}","gists_url":"https://api.github.com/users/dxcqcv/gists{/gist_id}","starred_url":"https://api.github.com/users/dxcqcv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dxcqcv/subscriptions","organizations_url":"https://api.github.com/users/dxcqcv/orgs","repos_url":"https://api.github.com/users/dxcqcv/repos","events_url":"https://api.github.com/users/dxcqcv/events{/privacy}","received_events_url":"https://api.github.com/users/dxcqcv/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-16T10:46:18Z","updated_at":"2018-03-20T12:00:37Z","closed_at":"2018-03-20T12:00:37Z","author_association":"NONE","body":"it will have two type of URL, fonts and img, but publicPath only can set all in one path\n\nso does anyway to make multiple publicPath options to make folder cleaner?\n\nlike \n\n```\n{\n  test: /\\.css$/,\n  exclude: ['/node_modules/'],\n  loader: ExtractTextPlugin.extract('style',['css'],{publicPath:{font:'fonts/',img:'img/'})\n},\n```\n\nnow my solution is combined `loader?&name=path` and `publicPath` like:\n\n```\n'use strict';\n\nconst webpack = require('webpack');\n\nconst siteRoot = '_site';\n// for browserSync\nconst BrowserSyncPlugin = require('browser-sync-webpack-plugin');\n// for clean folders before building\nconst CleanWebpackPlugin = require('clean-webpack-plugin');\n// for creation of HTML\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n// for extract css\nconst ExtractTextPlugin = require('extract-text-webpack-plugin');\n\n\n// path\nconst path = require('path');\nconst PATHS = {\n  app: path.join(__dirname, 'src'),\n  bin: path.join(__dirname, '')\n};\n\n// for get multiple entry list\nfunction getEntryList (type) {\n  let glob = require('glob');\n  let fileList = [];\n\n  let entryList = glob.sync(PATHS.app+'/**/*.'+type).reduce(function(o,v,i) {\n    let regex = /([^\\/]+)(?=\\.\\w+$)/;\n    let index = v.match(regex)[0];\n    o[index] = v;\n    return o;\n  },{});\n  return entryList;\n} \n\n/**\n * loop multiple files\n */\nlet entryHtmlPlugins = Object.keys(getEntryList('pug')).map(function(entryName){\n  let v = getEntryList('pug')[entryName]; // get full path\n  let filenamePath = v.split(/src\\/([^.]*)/)[1] +'.html';\n  let templatePath = v.split(/(src\\/.*)/)[1];\n  // filter chunks config\n  let chunkList = [];\n  switch(entryName){\n    case 'default':\n      chunkList.push('commons','index');\n  }\n  return new HtmlWebpackPlugin({\n    filename: filenamePath,\n    chunks: chunkList,\n    template: templatePath\n  })\n});\n\nmodule.exports = {\n  entry: getEntryList('ts'),\n  output: {\n    path: PATHS.bin,\n//    publicPath: '{{site.baseurl}}/',\n    publicPath: './',\n    filename: 'js/[name]-[hash:8].js'\n  },\n      // Enable sourcemaps for debugging webpack's output.\n    devtool: \"source-map\",\n\n    resolve: {\n        // Add '.ts' and '.tsx' as resolvable extensions.\n        extensions: [\"\", \".webpack.js\", \".web.js\", \".ts\", \".tsx\", \".js\",\"styl\"]\n    },\n  module: {\n    preLoaders: [\n      {\n        test: /\\.js$/,\n        exclude: /node_modules/,\n        loader: 'jshint'\n      }\n    ],\n    loaders: [\n        {\n        test: /\\.woff(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n        loader: \"url?limit=10000&mimetype=application/font-woff&name=./fonts/[name]-[hash].[ext]\"\n      }, {\n        test: /\\.woff2(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n        loader: \"url?limit=10000&mimetype=application/font-woff&name=./fonts/[name]-[hash].[ext]\"\n      }, {\n        test: /\\.ttf(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n        loader: \"url?limit=10000&mimetype=application/octet-stream&name=./fonts/[name]-[hash].[ext]\"\n      }, {\n        test: /\\.eot(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n        loader: \"file?&name=./fonts/[name]-[hash].[ext]\"\n      }, {\n        test: /\\.svg(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n        loader: \"url?limit=10000&mimetype=image/svg+xml&name=./fonts/[name]-[hash].[ext]\"\n      },\n      /********* css to js */\n      {\n        test: /\\.css$/,\n        exclude: ['/node_modules/'],\n        loader: ExtractTextPlugin.extract('style',['css'],{publicPath:'.'})\n      },\n      /********* pug to js */\n      {\n        test:/\\.pug$/,\n        exclude: /node_modules/,\n        loader: 'pug-html-loader',\n        query: {\n          pretty: true\n        }\n      },\n      /********* ts to js */\n      {\n        test:/\\.ts$/,\n        exclude: /node_modules/,\n        loader: 'ts-loader'\n      },\n      /********* stylus to css*/\n      {\n        test: /\\.styl$/,\n        exclude: ['/node_modules/','/src/css/includes/'],\n        loader: ExtractTextPlugin.extract('style',['css','stylus'])\n      },\n      /********* url loader*/\n      {\n        test: /\\.(png|jpg)$/,\n        exclude: /node_modules/,\n        loader: 'url-loader?limit=8192&name=[name]-[hash:8].[ext]'\n      }\n    ]\n  },\n  watch: true,\n  plugins: [\n    /** clean folders */\n    new CleanWebpackPlugin(['css/','js/','_site/js/','_site/css/'],{\n      root: __dirname,\n      verbose: true,\n      dry: false \n    }),\n    /** commonsPlugin */\n    new webpack.optimize.CommonsChunkPlugin(\"commons\", \"js/commons-[hash:8].js\"),\n    /** extract css */\n    new ExtractTextPlugin('css/[name]-[hash:8].css'),\n    new BrowserSyncPlugin({\n      files: [siteRoot + '/**'],\n      host: 'localhost',\n      port: 3000,\n      server: { baseDir: [siteRoot] }\n    },{reload:true})\n  ].concat(entryHtmlPlugins),\n  jshint: {\n    esversion: 6\n  }\n};\n```\n\nbecause my folder tree is \n\nroot\n  |\n  |__CSS\n  |\n  |__fonts\n  |\n  |__src\n  |\n  |__js\n"}}
{"actor":{"display_login":"michael-ciniawsky"}}