Skip to content
Snippets Groups Projects
Commit 2764d2eb authored by James Curtin's avatar James Curtin Committed by James Curtin
Browse files

Include all image files by default

parent 1ba71a72
No related branches found
No related tags found
No related merge requests found
{{cookiecutter.app_name}}/assets/img/favicon.ico

58.2 KiB

......@@ -10,6 +10,12 @@ require('jquery');
require('popper.js');
require('bootstrap');
require.context(
"../img", // context folder
true, // include subdirectories
/.*/ // RegExp
)
// Your own code
require('./plugins.js');
require('./script.js');
......@@ -37,16 +37,16 @@
"babel-preset-env": "^1.7.0",
"concurrently": "^5.0.0",
"css-loader": "^3.0.0",
"eslint": "^6.2.2",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.17.3",
"eslint": "^6.2.2",
"file-loader": "^4.0.0",
"less-loader": "^5.0.0",
"less": "^3.9.0",
"less-loader": "^5.0.0",
"mini-css-extract-plugin": "^0.8.0",
"raw-loader": "^3.0.0",
"url-loader": "^2.0.0",
"webpack-cli": "^3.3.2",
"webpack": "^4.33.0"
"webpack": "^4.33.0",
"webpack-cli": "^3.3.2"
}
}
......@@ -6,9 +6,16 @@ const webpack = require('webpack');
*/
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
// take debug mode from the environment
const debug = (process.env.NODE_ENV !== 'production');
const ProductionPlugins = [
// production webpack plugins go here
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("production")
}
})
]
const debug = (process.env.NODE_ENV !== 'production');
const rootAssetPath = path.join(__dirname, 'assets');
module.exports = {
......@@ -22,16 +29,21 @@ module.exports = {
path.join(__dirname, 'assets', 'css', 'style.css'),
],
},
mode: debug,
output: {
chunkFilename: "[id].js",
filename: "[name].bundle.js",
path: path.join(__dirname, "{{cookiecutter.app_name}}", "static", "build"),
publicPath: "/static/build/",
filename: "[name].js",
chunkFilename: "[id].js"
publicPath: "/static/build/"
},
resolve: {
extensions: [".js", ".jsx", ".css"]
},
devtool: "source-map",
devtool: debug ? "eval-source-map" : null,
plugins: [
new MiniCssExtractPlugin({ filename: "[name].bundle.css" }),
new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery" })
].concat(debug ? [] : ProductionPlugins),
module: {
rules: [
{
......@@ -66,20 +78,5 @@ module.exports = {
},
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader', query: { presets: ['env'], cacheDirectory: true } },
],
},
plugins: [
new MiniCssExtractPlugin({ filename: "[name].css" }),
new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery" })
].concat(
debug
? []
: [
// production webpack plugins go here
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("production")
}
})
]
)
}
};
......@@ -10,6 +10,7 @@
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="{{static_url_for('static', filename='build/img/favicon.ico') }}">
<title>
{% block page_title %} {% endraw %}
{{ cookiecutter.project_name }}
......@@ -27,7 +28,7 @@
<link
rel="stylesheet"
type="text/css"
href="{{ static_url_for('static', filename='build/main_css.css') }}"
href="{{ static_url_for('static', filename='build/main_css.bundle.css') }}"
/>
{% block css %}{% endblock %}
......@@ -61,7 +62,7 @@
{% include "footer.html" %}
<!-- JavaScript at the bottom for fast page loading -->
<script src="{{ static_url_for('static', filename='build/main_js.js') }}"></script>
<script src="{{ static_url_for('static', filename='build/main_js.bundle.js') }}"></script>
{% block js %}{% endblock %}
<!-- end scripts -->
{% endblock %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment