我有一个包含多个SVG文件的图标文件夹,我想添加这些文件,以便我可以在我的localhost应用程序中使用这些svg文件。
但我不是如何在下面使用它们是webpack配置。在complie之后,它在priv文件夹
中生成了最终的application.js和application.css文件-->priv
-->css
--> application.css
-->js
--> application.js
我想在此priv
中添加一个文件夹-->priv
-->css
--> application.css
-->js
--> application.js
-->asserts
--> first folder
-->few svg files
--> another folder
--> few svg files
webpack.config.js文件
//webpacks neat!
'use strict';
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var webpack = require('webpack');
function join(dest) { return path.resolve(__dirname, dest); }
function web(dest) { return join('web/static/' + dest); }
var config = module.exports = {
devtool: 'eval',
entry: {
application: [
web('css/application.sass'),
web('js/application.js'),
web('assets/'),
],
transactions: [
web('css/application.sass'),
web('js/transactions.js')
]
},
output: {
path: join('priv/static'),
filename: 'js/[name].js',
},
resolve: {
extensions: ['', '.js', '.sass', '.css'],
modulesDirectories: ['node_modules'],
},
module: {
noParse: /vendor\/phoenix/,
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
cacheDirectory: true,
plugins: ['transform-decorators-legacy'],
presets: ['react', 'es2015', 'stage-2', 'stage-0'],
},
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader")
},
{
test: /\.sass$/,
loader: ExtractTextPlugin.extract('style', 'css!sass?indentedSyntax&includePaths[]=' + __dirname + '/node_modules'),
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=100000'
},{
test: /\.svg$/,
loader: 'svg-inline'
}
],
},
plugins: [
new ExtractTextPlugin('css/application.css')
],
};
if (process.env.NODE_ENV === 'production') {
config.plugins.push(
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({ minimize: true })
);
}
我把asserts文件夹放在priv文件夹中,但我仍然无法访问asserts文件夹中的那些svg文件。
有关如何访问本地服务器中的内容的任何建议吗?