Skip to content

Commit

Permalink
created web pack setting for dist
Browse files Browse the repository at this point in the history
  • Loading branch information
VJAI committed Mar 12, 2022
1 parent b3033a5 commit f959748
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 11 deletions.
5 changes: 0 additions & 5 deletions .npmignore

This file was deleted.

File renamed without changes.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 6 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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'
],
})
],
Expand Down
53 changes: 53 additions & 0 deletions webpack.docs.config.js
Original file line number Diff line number Diff line change
@@ -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
}
};

0 comments on commit f959748

Please sign in to comment.