From ea3339d41398e454f43fb40cd0dabf82bfa69fd1 Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Thu, 16 Mar 2023 11:47:59 +0100 Subject: [PATCH] =?UTF-8?q?Replace=20Gulp=20with=20Vite=20=E2=9A=A1?= =?UTF-8?q?=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintignore | 1 - .eslintrc.json | 2 +- .gitignore | 2 +- .prettierignore | 1 - gulpfile.js | 49 - src/index.html => index.html | 7 +- {src => lib}/count.js | 2 +- {src => lib}/main.js | 4 +- {src => lib}/scss/_fonts.scss | 2 +- {src => lib}/scss/_variables.scss | 2 +- {src => lib}/scss/style.scss | 2 +- package.json | 27 +- pnpm-lock.yaml | 4111 +++++++---------- {src/static => public}/apple-touch-icon.png | Bin {src/static => public}/favicon.ico | Bin {src/static => public}/fonts/Roboto-400.woff | Bin {src/static => public}/fonts/Roboto-400.woff2 | Bin {src/static => public}/fonts/Roboto-500.woff | Bin {src/static => public}/fonts/Roboto-500.woff2 | Bin {src/static => public}/icon-192.png | Bin {src/static => public}/icon-512.png | Bin {src/static => public}/icon.svg | 0 {src/static => public}/mastodon.svg | 0 {src/static => public}/robots.txt | 0 {src/static => public}/site.webmanifest | 0 vite.config.js | 10 + 26 files changed, 1776 insertions(+), 2446 deletions(-) delete mode 100644 gulpfile.js rename src/index.html => index.html (93%) rename {src => lib}/count.js (96%) rename {src => lib}/main.js (97%) rename {src => lib}/scss/_fonts.scss (95%) rename {src => lib}/scss/_variables.scss (94%) rename {src => lib}/scss/style.scss (98%) rename {src/static => public}/apple-touch-icon.png (100%) rename {src/static => public}/favicon.ico (100%) rename {src/static => public}/fonts/Roboto-400.woff (100%) rename {src/static => public}/fonts/Roboto-400.woff2 (100%) rename {src/static => public}/fonts/Roboto-500.woff (100%) rename {src/static => public}/fonts/Roboto-500.woff2 (100%) rename {src/static => public}/icon-192.png (100%) rename {src/static => public}/icon-512.png (100%) rename {src/static => public}/icon.svg (100%) rename {src/static => public}/mastodon.svg (100%) rename {src/static => public}/robots.txt (100%) rename {src/static => public}/site.webmanifest (100%) create mode 100644 vite.config.js diff --git a/.eslintignore b/.eslintignore index c0736f4..178135c 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1 @@ /dist/ -/public/ diff --git a/.eslintrc.json b/.eslintrc.json index 5aebfd9..aff8587 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -9,7 +9,7 @@ }, "overrides": [ { - "files": ["gulpfile.js", "api/*.js"], + "files": ["api/*.js"], "env": { "node": true, "browser": false diff --git a/.gitignore b/.gitignore index a5a863a..5974ade 100644 --- a/.gitignore +++ b/.gitignore @@ -302,5 +302,5 @@ $RECYCLE.BIN/ # End of https://www.toptal.com/developers/gitignore/api/node,now,visualstudiocode,webstorm+all,windows,macos,linux -/public +/dist/ *.min.svg diff --git a/.prettierignore b/.prettierignore index 1ab3f0c..3019ed6 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,4 @@ *.md /dist/ -/public/ /.vercel/ pnpm-lock.yaml diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index db4e5db..0000000 --- a/gulpfile.js +++ /dev/null @@ -1,49 +0,0 @@ -const path = require("path"); -const gulp = require("gulp"); -const postcss = require("gulp-postcss"); -const sass = require("gulp-sass")(require("sass")); -const sourcemaps = require("gulp-sourcemaps"); -const terser = require("gulp-terser"); - -const SOURCE_DIR = path.resolve(__dirname, "src"); -const OUTPUT_DIR = path.resolve(__dirname, "public"); - -function html() { - return gulp - .src(path.join(SOURCE_DIR, "index.html")) - .pipe(gulp.dest(OUTPUT_DIR)); -} - -function css() { - return gulp - .src(path.join(SOURCE_DIR, "scss", "*.scss")) - .pipe(sourcemaps.init()) - .pipe(sass.sync().on("error", sass.logError)) - .pipe(postcss([require("autoprefixer"), require("postcss-csso")])) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(OUTPUT_DIR)); -} - -function js() { - return gulp - .src([path.join(SOURCE_DIR, "main.js"), path.join(SOURCE_DIR, "count.js")]) - .pipe(sourcemaps.init()) - .pipe(terser({ ecma: 5 })) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(OUTPUT_DIR)); -} - -function staticFiles() { - return gulp - .src(path.join(SOURCE_DIR, "static", "**", "*")) - .pipe(gulp.dest(OUTPUT_DIR)); -} - -exports.default = gulp.parallel(html, css, js, staticFiles); - -exports.watch = () => { - gulp.watch(path.join(SOURCE_DIR, "index.html"), html); - gulp.watch(path.join(SOURCE_DIR, "scss", "*.scss"), css); - gulp.watch(path.join(SOURCE_DIR, "*.js"), js); - gulp.watch(path.join(SOURCE_DIR, "static", "**", "*"), staticFiles); -}; diff --git a/src/index.html b/index.html similarity index 93% rename from src/index.html rename to index.html index 309fc2b..82083e5 100644 --- a/src/index.html +++ b/index.html @@ -1,5 +1,5 @@