Skip to content

Commit

Permalink
new directory main
Browse files Browse the repository at this point in the history
  • Loading branch information
necitboss committed Oct 27, 2024
1 parent 0d72b56 commit 47434f3
Show file tree
Hide file tree
Showing 15 changed files with 7,086 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/hello_world/_front/node_modules
/hello_world/_front/_public
=======
/node_modules
/front/node_modules
/front/_public
/main/node_modules
/main/_front/node_modules
/main/_front/_public
>>>>>>> 1bb3c6b2939a7acc08003a19a6d78099460efe90
/.idea
2 changes: 1 addition & 1 deletion hello_world/_front/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const html = () => {
export const scss = () => {
return gulp.src(path.src.css, {sourcemaps: true})
.pipe(sassGlob())
.pipe(sass())
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(path.build.css))
}

Expand Down
98 changes: 98 additions & 0 deletions main/_front/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import gulp from "gulp"
import browserSync from "browser-sync";
import gulpReplace from "gulp-replace";

import dartSass from 'sass';
import gulpSass from 'gulp-sass';
const sass = gulpSass(dartSass);

const publicPath = "_public/";
const srcPath = "src/";
import sassGlob from 'gulp-sass-glob';
import newer from "gulp-newer";
import {deleteAsync} from "del";

const path = {
build: {
html: publicPath,
css: publicPath + "css/",
js: publicPath + "js/",
img: publicPath + "img/",
font: publicPath + "font/"
},
src: {
html: srcPath + "html/*.html",
css: srcPath + "scss/style.scss",
js: srcPath + "js/**/*.js",
img: srcPath + "img/**/*.{jpg,jpeg,png,svg,gif,ico,webp}",
font: srcPath + "font/**/*.{eot,woff,woff2,ttf,svg}"
},
watch: {
html: srcPath + "html/**/*.html",
css: srcPath + "scss/**/*.scss",
js: srcPath + "js/**/*.js",
img: srcPath + "img/**/*.{jpg,jpeg,png,svg,gif,ico,webp}",
font: srcPath + "font/**/*.{eot,woff,woff2,ttf,svg}"
}
}

export const html = () => {
return gulp.src(path.src.html)
.pipe(gulpReplace(/src="\.\.\//g, "src=\"./"))
.pipe(gulpReplace(/href=["']\.\.\/scss\/style\.scss/g, "href=\"css/style.css"))
.pipe(gulpReplace(/src=["']\.\.\/([^"']+\.js)["']/g, 'src="$1"'))
.pipe(gulp.dest(path.build.html))
.pipe(browserSync.stream())
}

export const scss = () => {
return gulp.src(path.src.css, {sourcemaps: true})
.pipe(sassGlob())
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(path.build.css))
}


export const js = () => {
return gulp.src(path.src.js)
.pipe(gulp.dest(path.build.js));
}

export const clear = () => {
return deleteAsync("./_public");
}

export const img = () => {
return gulp.src(path.src.img, {encoding: false})
.pipe(gulp.dest(path.build.img))
}

export const font = () => {
return gulp.src(path.src.font)
.pipe(newer(path.build.font))
.pipe(gulp.dest(path.build.font))
}

export const server = () => {
browserSync.init({
server: {
baseDir: "./_public"
}
})
}

export const watch = () => {
gulp.watch(path.watch.html, html).on("all", browserSync.reload);
gulp.watch(path.watch.css, scss).on("all", browserSync.reload);
gulp.watch(path.watch.js, js).on("all", browserSync.reload);
gulp.watch(path.watch.img, img).on("all", browserSync.reload);
gulp.watch(path.watch.font, font).on("all", browserSync.reload);
}

const dev = gulp.series(
clear,
gulp.parallel(html, scss, js, img, font),
gulp.parallel(watch, server)
)

export default dev;
Loading

0 comments on commit 47434f3

Please sign in to comment.