diff --git a/.editorconfig b/.editorconfig index 65932d2edc..332f3a5d3f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,9 +8,8 @@ root = true end_of_line = lf insert_final_newline = true -# Matches multiple files with brace expansion notation # Set default charset -[*.{js,ts,less}] +[*.{js,ts,scss,html}] charset = utf-8 indent_style = space indent_size = 4 diff --git a/src/notification/bar.js b/src/notification/bar.js index c52965ab22..086aefe4e1 100644 --- a/src/notification/bar.js +++ b/src/notification/bar.js @@ -1,4 +1,4 @@ -require('./bar.less'); +require('./bar.scss'); document.addEventListener('DOMContentLoaded', function () { var i18n = {}; diff --git a/src/notification/bar.less b/src/notification/bar.scss similarity index 100% rename from src/notification/bar.less rename to src/notification/bar.scss diff --git a/webpack.common.js b/webpack.common.js deleted file mode 100644 index 09ec4e491b..0000000000 --- a/webpack.common.js +++ /dev/null @@ -1,129 +0,0 @@ -const path = require('path'); -const webpack = require('webpack'); -const CleanWebpackPlugin = require('clean-webpack-plugin'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const CopyWebpackPlugin = require('copy-webpack-plugin'); - -const isVendorModule = (module) => { - if (!module.context) { - return false; - } - - const nodeModule = module.context.indexOf('node_modules') !== -1; - const bitwardenModule = module.context.indexOf('@bitwarden') !== -1; - return nodeModule && !bitwardenModule; -}; - -module.exports = { - entry: { - 'popup/app': './src/popup/app/app.js', - 'background': './src/background.ts', - 'content/autofill': './src/content/autofill.js', - 'content/autofiller': './src/content/autofiller.js', - 'content/notificationBar': './src/content/notificationBar.js', - 'content/shortcuts': './src/content/shortcuts.js', - 'notification/bar': './src/notification/bar.js', - 'downloader/downloader': './src/downloader/downloader.ts', - '2fa/2fa': './src/2fa/2fa.ts', - }, - module: { - rules: [ - { - test: /\.ts$/, - enforce: 'pre', - loader: 'tslint-loader' - }, - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules\/(?!(@bitwarden)\/).*/ - }, - { - test: /\.(html)$/, - loader: 'html-loader' - }, - { - test: /.(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/, - exclude: /loading.svg/, - use: [{ - loader: 'file-loader', - options: { - name: '[name].[ext]', - outputPath: 'popup/fonts/', - publicPath: './fonts/' - } - }] - }, - { - test: /\.(jpe?g|png|gif|svg)$/i, - exclude: /.*(fontawesome-webfont|glyphicons-halflings-regular)\.svg/, - use: [{ - loader: 'file-loader', - options: { - name: '[name].[ext]', - outputPath: 'popup/images/', - publicPath: './images/' - } - }] - } - ] - }, - plugins: [ - new CleanWebpackPlugin([ - path.resolve(__dirname, 'build/*') - ]), - new webpack.optimize.CommonsChunkPlugin({ - name: 'popup/vendor', - chunks: ['popup/app'], - minChunks: isVendorModule - }), - new webpack.optimize.CommonsChunkPlugin({ - name: 'vendor', - chunks: ['background'], - minChunks: isVendorModule - }), - new HtmlWebpackPlugin({ - template: './src/popup/index.html', - filename: 'popup/index.html', - chunks: ['popup/vendor', 'popup/app', 'fonts'] - }), - new HtmlWebpackPlugin({ - template: './src/background.html', - filename: 'background.html', - chunks: ['vendor', 'background'] - }), - new HtmlWebpackPlugin({ - template: './src/notification/bar.html', - filename: 'notification/bar.html', - chunks: ['notification/bar'] - }), - new HtmlWebpackPlugin({ - template: './src/downloader/index.html', - filename: 'downloader/index.html', - chunks: ['downloader/downloader'] - }), - new HtmlWebpackPlugin({ - template: './src/2fa/index.html', - filename: '2fa/index.html', - chunks: ['2fa/2fa'] - }), - new CopyWebpackPlugin([ - './src/manifest.json', - { from: './src/_locales', to: '_locales' }, - { from: './src/edge', to: 'edge' }, - { from: './src/safari', to: 'safari' }, - { from: './src/images', to: 'images' }, - { from: './src/content/autofill.css', to: 'content' } - ]) - ], - resolve: { - extensions: ['.tsx', '.ts', '.js'], - alias: { - jslib: path.join(__dirname, 'jslib/src') - } - }, - output: { - filename: '[name].js', - path: path.resolve(__dirname, 'build') - } -}; diff --git a/webpack.config.js b/webpack.config.js index 57306efccc..04e0565e24 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -27,6 +27,7 @@ const config = { 'content/autofiller': './src/content/autofiller.js', 'content/notificationBar': './src/content/notificationBar.js', 'content/shortcuts': './src/content/shortcuts.js', + 'notification/bar': './src/notification/bar.js', 'downloader/downloader': './src/downloader/downloader.ts', '2fa/2fa': './src/2fa/2fa.ts', }, @@ -131,6 +132,11 @@ const config = { filename: 'background.html', chunks: ['vendor', 'background'], }), + new HtmlWebpackPlugin({ + template: './src/notification/bar.html', + filename: 'notification/bar.html', + chunks: ['notification/bar'] + }), new HtmlWebpackPlugin({ template: './src/downloader/index.html', filename: 'downloader/index.html', diff --git a/webpack.dev.js b/webpack.dev.js deleted file mode 100644 index b2ff1b5782..0000000000 --- a/webpack.dev.js +++ /dev/null @@ -1,24 +0,0 @@ -const merge = require('webpack-merge'); -const common = require('./webpack.common.js'); - -module.exports = merge(common, { - devtool: 'inline-source-map', - module: { - rules: [ - { - test: /\.less$/, - use: [ - { - loader: 'style-loader' - }, - { - loader: 'css-loader', - }, - { - loader: 'less-loader', - } - ] - } - ] - } -}); diff --git a/webpack.prod.js b/webpack.prod.js deleted file mode 100644 index 264f765610..0000000000 --- a/webpack.prod.js +++ /dev/null @@ -1,41 +0,0 @@ -const merge = require('webpack-merge'); -const ExtractTextPlugin = require('extract-text-webpack-plugin'); -const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); -const common = require('./webpack.common.js'); -const webpack = require('webpack'); - -const extractLess = new ExtractTextPlugin({ - filename: '[name].css', - disable: false, - allChunks: true -}); - -module.exports = merge(common, { - module: { - rules: [ - { - test: /\.less$/, - use: extractLess.extract({ - use: [ - { - loader: 'css-loader', - }, - { - loader: 'less-loader', - } - ] - }) - } - ] - }, - plugins: [ - new UglifyJSPlugin({ - include: ['vendor.js', 'popup/vendor.js'] - }), - new webpack.SourceMapDevToolPlugin({ - filename: '[name].js.map', - include: ['background.js', 'popup/app.js'] - }), - extractLess - ] -});