Skip to content

Commit

Permalink
Using a bundler
Browse files Browse the repository at this point in the history
  • Loading branch information
DarKDinDoN committed Sep 5, 2023
1 parent e206c19 commit 646931a
Show file tree
Hide file tree
Showing 9 changed files with 12,497 additions and 3,310 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
readme: https://github.com/${{github.repository}}/raw/main/README.md

# Create a zip file with all files required by the module to add to the release
- run: zip -r ./module.zip module.json LICENSE languages/ modules/ styles/build/theme-glass.css
- run: zip -r ./module.zip module.json LICENSE languages/ build/

# Create a release for this specific version
- name: Update Release with Files
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions build/theme-glass.js

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

58 changes: 58 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const gulp = require("gulp");
const compiler = require("webpack");
const webpack = require("webpack-stream");
const named = require("vinyl-named");
const postcss = require("gulp-postcss");

/* ----------------------------------------- */
/* Compile CSS
/* ----------------------------------------- */

const SYSTEM_SCSS = ["styles/**/*.css"];
/**
* Compile CSS
* @returns {object}
*/
function compileCss() {
return gulp.src("styles/theme-glass.css").pipe(postcss()).pipe(gulp.dest("./build"));
}
const css = gulp.series(compileCss);

/* ----------------------------------------- */
/* Compile Javascript
/* ----------------------------------------- */

const SYSTEM_JS = ["modules/**/*.js"];
/**
* Compile JS
* @returns {object}
*/
function compileJs() {
return gulp
.src(["modules/theme-glass.js"])
.pipe(named())
.pipe(webpack({ mode: "production" }, compiler))
.pipe(gulp.dest("./build"));
}
const js = gulp.series(compileJs);

/* ----------------------------------------- */
/* Watch Updates
/* ----------------------------------------- */

/**
* Watch modifications
*/
function watchUpdates() {
gulp.watch(SYSTEM_SCSS, css);
gulp.watch(SYSTEM_JS, js);
}

/* ----------------------------------------- */
/* Export Tasks
/* ----------------------------------------- */

exports.default = gulp.series(compileCss, compileJs, watchUpdates);
exports.build = gulp.series(compileCss, compileJs);
exports.css = css;
exports.js = js;
6 changes: 3 additions & 3 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
"conflicts": [],
"socket": true,
"scripts": [],
"esmodules": ["./modules/module.js"],
"styles": ["styles/build/theme-glass.css"],
"esmodules": ["./build/theme-glass.js"],
"styles": ["./build/theme-glass.css"],
"flags": {
"hotReload": {
"extensions": ["css"],
"paths": ["styles/build/theme-glass.css"]
"paths": ["build/theme-glass.css"]
}
},
"languages": [
Expand Down
File renamed without changes.

0 comments on commit 646931a

Please sign in to comment.