From f959748b7271ae8f473aa1f2aa69c332a9631a4e Mon Sep 17 00:00:00 2001 From: VJAI Date: Sat, 12 Mar 2022 11:23:48 +0530 Subject: [PATCH] created web pack setting for dist --- .npmignore | 5 ---- LICENSE => LICENSE.txt | 0 package.json | 5 ++-- webpack.config.js | 10 ++++---- webpack.docs.config.js | 53 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 62 insertions(+), 11 deletions(-) delete mode 100644 .npmignore rename LICENSE => LICENSE.txt (100%) create mode 100644 webpack.docs.config.js diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 0bb7bc4..0000000 --- a/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -.idea -node_modules -npm-debug.log* -.DS_Store -docs \ No newline at end of file diff --git a/LICENSE b/LICENSE.txt similarity index 100% rename from LICENSE rename to LICENSE.txt diff --git a/package.json b/package.json index 7b49a76..ef61444 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,11 @@ { "name": "fibonacci-blog-template", - "version": "3.0.4", + "version": "3.1.1", "description": "A simplistic read-friendly blog template built with golden ratio", "scripts": { "start": "webpack-dev-server --config webpack.dev.config.js", - "build": "rm -rf docs && webpack" + "docs": "rm -rf docs && webpack --config webpack.docs.config.js", + "build": "rm -rf dist && webpack" }, "keywords": [ "template", diff --git a/webpack.config.js b/webpack.config.js index b1ec598..2bba21c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -3,7 +3,7 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const CopyPlugin = require('copy-webpack-plugin'); const srcDir = path.resolve(__dirname, 'src'), - distDir = path.resolve(__dirname, 'docs'); + distDir = path.resolve(__dirname, 'dist'); module.exports = { mode: 'production', @@ -12,9 +12,11 @@ module.exports = { new MiniCssExtractPlugin(), new CopyPlugin({ patterns: [ - { from: '*.html', context: srcDir }, - { from: 'blog_resources', to: 'blog_resources/', context: srcDir }, - { from: 'assets', to: 'assets/', context: srcDir } + { from: 'scss', to: 'scss/', context: srcDir }, + { from: 'assets', to: 'assets/', context: srcDir }, + 'LICENSE.txt', + 'README.md', + 'package.json' ], }) ], diff --git a/webpack.docs.config.js b/webpack.docs.config.js new file mode 100644 index 0000000..b141ab0 --- /dev/null +++ b/webpack.docs.config.js @@ -0,0 +1,53 @@ +const path = require('path'); +const MiniCssExtractPlugin = require('mini-css-extract-plugin'); +const CopyPlugin = require('copy-webpack-plugin'); + +const srcDir = path.resolve(__dirname, 'src'), + docsDir = path.resolve(__dirname, 'docs'); + +module.exports = { + mode: 'production', + entry: { fibonacci: './src/fibonacci.js' }, + plugins: [ + new MiniCssExtractPlugin(), + new CopyPlugin({ + patterns: [ + { from: '*.html', context: srcDir }, + { from: 'blog_resources', to: 'blog_resources/', context: srcDir }, + { from: 'assets', to: 'assets/', context: srcDir } + ], + }) + ], + output: { + path: docsDir + }, + module: { + rules: [ + { + test: /\.s[ac]ss$/i, + use: [ + MiniCssExtractPlugin.loader, + { + loader: 'css-loader', + options: { import: false } + }, + 'sass-loader', + ], + }, + { + test: /\.js[x]?$/, + exclude: /(node_modules)/, + use: { + loader: 'babel-loader' + } + } + ] + }, + resolve: { + modules: [path.resolve(__dirname), 'node_modules'], + extensions: ['.js', '.json', '.css', '.scss', '.sass'] + }, + optimization: { + minimize: true + } +}; \ No newline at end of file