Include all image files by default

master
James Curtin 5 years ago committed by James Curtin
parent 1ba71a7279
commit 2764d2eba4
  1. BIN
      {{cookiecutter.app_name}}/assets/img/favicon.ico
  2. 6
      {{cookiecutter.app_name}}/assets/js/main.js
  3. 8
      {{cookiecutter.app_name}}/package.json
  4. 41
      {{cookiecutter.app_name}}/webpack.config.js
  5. 5
      {{cookiecutter.app_name}}/{{cookiecutter.app_name}}/templates/layout.html

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 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 %}

Loading…
Cancel
Save