diff --git a/README.md b/README.md
index f16c668..ae87793 100644
--- a/README.md
+++ b/README.md
@@ -156,6 +156,9 @@ import '@/icons/github.svg'
- [stylelint-webpack-plugin](https://github.com/webpack-contrib/stylelint-webpack-plugin)
- [StyleLint](https://github.com/stylelint/stylelint)
+- Terminal
+ - [TerminalClearPlugin](./config/plugins/clearTerminal.plugin.js)
+
diff --git a/config/plugins/README.md b/config/plugins/README.md
index 224d5d4..fac6d44 100644
--- a/config/plugins/README.md
+++ b/config/plugins/README.md
@@ -13,3 +13,6 @@
## Stylelint
- [stylelint-webpack-plugin](https://github.com/webpack-contrib/stylelint-webpack-plugin)
- [StyleLint](https://github.com/stylelint/stylelint)
+
+## Terminal
+- [TerminalClearPlugin](./clearTerminal.plugin.js)
diff --git a/config/plugins/clearTerminal.plugin.js b/config/plugins/clearTerminal.plugin.js
new file mode 100644
index 0000000..765144e
--- /dev/null
+++ b/config/plugins/clearTerminal.plugin.js
@@ -0,0 +1,30 @@
+/**
+ * Class representing a webpack plugin for clearing the terminal screen.
+ *
+ * @requires webpack version >=4
+ * @version 1.0.0
+ * @author janeRivas
+ * @license MIT
+ */
+class TerminalClearPlugin {
+ /**
+ * @param {Boolean} [saveHistory=true] - indicates whether to keep the terminal history or not
+ */
+ constructor({ saveHistory = true } = { }) {
+ this.saveHistory = saveHistory
+ }
+
+ /**
+ * Installs the plugin.
+ * https://webpack.js.org/contribute/writing-a-plugin/#basic-plugin-architecture
+ */
+ apply(compiler) {
+ compiler.hooks.beforeCompile.tapAsync('TerminalClearPlugin', (params, callback) => {
+ process.stdout.write(this.saveHistory ? '\x1B[H\x1B[2J' : '\x1B[2J\x1B[3J\x1B[H\x1Bc')
+ callback()
+ })
+ }
+}
+
+
+module.exports = new TerminalClearPlugin()
diff --git a/config/webpack/webpack.common.config.js b/config/webpack/webpack.common.config.js
index 41ea9f8..b35201b 100644
--- a/config/webpack/webpack.common.config.js
+++ b/config/webpack/webpack.common.config.js
@@ -2,6 +2,7 @@ const { SOURCE_DIR } = require('../helpers')
const htmlPlugin = require('../plugins/html.plugin.js')
const eslintPlugin = require('../plugins/eslint.plugin.js')
const stylelintPlugin = require('../plugins/stylelint.plugin.js')
+const clearTerminal = require('../plugins/clearTerminal.plugin.js')
const javascriptLoader = require('../loaders/javascript.loader.js')
const typescriptLoader = require('../loaders/typescript.loader.js')
const nunjucksLoader = require('../loaders/nunjucks.loader.js')
@@ -22,6 +23,7 @@ module.exports = {
},
stats: { all: false },
plugins: [
+ clearTerminal,
...htmlPlugin,
eslintPlugin,
stylelintPlugin