Skip to content
This repository has been archived by the owner on Dec 25, 2023. It is now read-only.

Commit

Permalink
Apply changes from Lychee (#3)
Browse files Browse the repository at this point in the history
* Add workflow and prettier

* fix git

* don't install git

* fix job nsme

* Update gitignore

* fix format

* Apply changes from Lychee

* Fix + rebuild

* Fix SCSS

* fix build

* fix git job

* update metadata

* use tabs

* Reformat

* update metadata

* reformat

* update lockfile

* fix git job again

* Fix lockfile

* Remove gulp plugins

* Rework gulpfile

Change it to be similar to basicModal

* Fix styles

* Bump version

* Add scope to name
  • Loading branch information
qwerty287 authored Oct 21, 2022
1 parent 0e23b1b commit ba224e6
Show file tree
Hide file tree
Showing 16 changed files with 9,049 additions and 4,624 deletions.
2 changes: 1 addition & 1 deletion dist/addons/fadein.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/addons/popin.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/basicContext.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 1 addition & 17 deletions dist/basicContext.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/themes/bright.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/themes/dark.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/themes/default.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion dist/themes/light.min.css

This file was deleted.

107 changes: 54 additions & 53 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,74 +1,75 @@
var name = require("./package.json").moduleName,
fs = require("fs"),
gulp = require("gulp"),
plugins = require("gulp-load-plugins")();
sass = require("gulp-sass")(require("sass"));
"use strict";

var head = fs.readFileSync("./node_modules/@electerious/modulizer/head.js", {
encoding: "utf8",
}),
foot = fs.readFileSync("./node_modules/@electerious/modulizer/foot.js", {
encoding: "utf8",
});
const name = require("./package.json").moduleName;
const gulp = require("gulp");
const browserify = require("browserify");
const babelify = require("babelify");
const source = require("vinyl-source-stream");
const buffer = require("vinyl-buffer");
const uglify = require("gulp-uglify");
const sass = require("gulp-sass")(require("sass"));
const rename = require("gulp-rename");
const autoprefixer = require("gulp-autoprefixer");
const csso = require("gulp-csso");

var catchError = function (err) {
const catchError = function (err) {
console.log(err.toString());
this.emit("end");
};

gulp.task("styles", function () {
gulp
.src("./src/styles/main.scss")
.pipe(sass().on("error", catchError))
gulp.task("scripts", function () {
return browserify({
entries: "./src/scripts/basicContext.js",
standalone: name,
})
.transform(
babelify.configure({
presets: ["@babel/preset-env"],
})
)
.bundle()
.on("error", catchError)
.pipe(source(name + ".min.js"))
.pipe(buffer())
.pipe(uglify())
.on("error", catchError)
.pipe(plugins.concat(name + ".min.css", { newLine: "\n" }))
.pipe(plugins.autoprefixer("last 2 version", "> 1%"))
.pipe(plugins.minifyCss())
.pipe(gulp.dest("./dist"));
});

gulp
.src("./src/styles/themes/*.scss")
.pipe(sass().on("error", catchError))
gulp.task("styles", function () {
return gulp
.src("./src/styles/main.scss")
.pipe(sass())
.on("error", catchError)
.pipe(
plugins.rename(function (path) {
path.basename += ".min";
})
)
.pipe(plugins.autoprefixer("last 2 version", "> 1%"))
.pipe(plugins.minifyCss())
.pipe(gulp.dest("./dist/themes"));
.pipe(rename((path) => (path.basename = name + ".min")))
.pipe(autoprefixer("last 2 version", "> 1%"))
.pipe(csso({ restructure: false }))
.pipe(gulp.dest("./dist"));
});

gulp.task("addons", function () {
return gulp
.src("./src/styles/addons/*.scss")
.pipe(sass().on("error", catchError))
.pipe(sass())
.on("error", catchError)
.pipe(
plugins.rename(function (path) {
path.basename += ".min";
})
)
.pipe(plugins.autoprefixer("last 2 version", "> 1%"))
.pipe(plugins.minifyCss())
.pipe(rename((path) => (path.basename = path.basename + ".min")))
.pipe(autoprefixer("last 2 version", "> 1%"))
.pipe(csso({ restructure: false }))
.pipe(gulp.dest("./dist/addons"));
});

gulp.task("scripts", function () {
gulp.task("themes", function () {
return gulp
.src("./src/scripts/*.js")
.pipe(plugins.header(head, { name: name }))
.pipe(plugins.footer(foot))
.pipe(plugins.babel())
.on("error", catchError)
.pipe(plugins.concat(name + ".min.js", { newLine: "\n" }))
.pipe(plugins.uglify())
.src("./src/styles/themes/*.scss")
.pipe(sass())
.on("error", catchError)
.pipe(gulp.dest("./dist"));
.pipe(rename((path) => (path.basename = path.basename + ".min")))
.pipe(autoprefixer("last 2 version", "> 1%"))
.pipe(csso({ restructure: false }))
.pipe(gulp.dest("./dist/themes"));
});

gulp.task("default", gulp.series(gulp.parallel("styles", "scripts")));

gulp.task("watch", gulp.series("default"), function () {
gulp.watch("./src/styles/**/*.scss", ["styles"]);
gulp.watch("./src/scripts/**/*.js", ["scripts"]);
});
gulp.task(
"default",
gulp.series(gulp.parallel("scripts", "styles", "addons", "themes"))
);
Loading

0 comments on commit ba224e6

Please sign in to comment.