Skip to content

Commit

Permalink
Update version 2
Browse files Browse the repository at this point in the history
  • Loading branch information
markusantonwolf authored and markusantonwolf committed Apr 14, 2021
1 parent 9f976bb commit 2feb29a
Show file tree
Hide file tree
Showing 87 changed files with 10,711 additions and 18,300 deletions.
42 changes: 42 additions & 0 deletions .config/default.json
@@ -0,0 +1,42 @@
{
"source": {
"layout": "./src/styles/layout.css",
"plugin_js": ["./src/scripts/ta-*.js"],
"plugin_css": "./src/styles/ta-gallery.css",
"alpine_js": ["./node_modules/alpinejs/dist/alpine.js"],
"plugin_alpine_js": ["./node_modules/alpinejs/dist/alpine.js", "./dist/js/ta-gallery.js"],
"views": ["./src/views/index.html"]
},
"name": {
"alpine_js": "alpine.js",
"plugin_js": "ta-gallery.js",
"plugin_alpine_js": "alpine-ta-gallery.js"
},
"purge": {
"content": ["./public/*.html","./src/snippets/*.html","./src/views/*.html"]
},
"destination": {
"layout": "./dist/css",
"plugin_css": "./dist/css",
"plugin_css_anim": "./dist/css",
"alpine_js": "./dist/js",
"plugin_js": "./dist/js",
"plugin_alpine_js": "./dist/js",
"views": "./public"
},
"distribution": {
"styles": ["./dist/css/**/*.css"],
"scripts": ["./dist/js/**/*.js"]
},
"public": {
"styles": "./public/css",
"scripts": "./public/js"
},
"watch": {
"styles": "./src/styles/*.css",
"scripts": "./src/scripts/*.js",
"views": "./src/views/*.html",
"snippets": "./src/snippets/*.html"
},
"clean": ["./dist", "./public/css", "./public/js"]
}
1 change: 1 addition & 0 deletions .config/production.json
@@ -0,0 +1 @@
{}
2 changes: 1 addition & 1 deletion .editorconfig
@@ -1,7 +1,7 @@
[*.{css,scss,less,js,json,ts,sass,html,hbs,mustache,phtml,html.twig,md,yml}]
charset = utf-8
indent_style = space
indent_size = 2
indent_size = 4
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
Expand Down
22 changes: 0 additions & 22 deletions .gulp/_tools.js

This file was deleted.

40 changes: 0 additions & 40 deletions .gulp/alpine.js

This file was deleted.

26 changes: 7 additions & 19 deletions .gulp/clean.js
@@ -1,24 +1,12 @@
const { src } = require('gulp')
const config = require('config')
const { src } = require('gulp')
const clean = require('gulp-clean')

const STYLES_DISTRIBUTION = config.get('gulp.styles.distribution')
const STYLES_DESTINATION = config.get('gulp.styles.destination')
const SCRIPTS_DISTRIBUTION = config.get('gulp.scripts.distribution')
const SCRIPTS_DESTINATION = config.get('gulp.scripts.destination')
const CLEAN = config.get('clean')

const fnc_delete = function () {
return src(
[
STYLES_DISTRIBUTION + '/**/*',
STYLES_DESTINATION + '/**/*',
SCRIPTS_DISTRIBUTION + '/**/*',
SCRIPTS_DESTINATION + '/**/*',
],
{
read: false,
}
).pipe(clean())
module.exports.clean = () => {
return src(CLEAN, {
read: false,
allowEmpty: true,
}).pipe(clean())
}

module.exports.clean = fnc_delete
43 changes: 0 additions & 43 deletions .gulp/config/default.json

This file was deleted.

35 changes: 18 additions & 17 deletions .gulp/copy.js
@@ -1,24 +1,25 @@
const { src, dest, parallel } = require('gulp')
const config = require('config')
const { src, dest, parallel } = require('gulp')
const print = require('gulp-print').default

const STYLES_DISTRIBUTION = config.get('gulp.styles.distribution')
const STYLES_DESTINATION = config.get('gulp.styles.destination')
const SCRIPTS_DISTRIBUTION = config.get('gulp.scripts.distribution')
const SCRIPTS_DESTINATION = config.get('gulp.scripts.destination')
const DISTRIBUTION_STYLES = config.get('distribution.styles')
const DISTRIBUTION_SCRIPTS = config.get('distribution.scripts')
const PUBLIC_SCRIPTS = config.get('public.scripts')
const PUBLIC_STYLES = config.get('public.styles')

const fnc_styles_copy = function () {
return src([STYLES_DISTRIBUTION + '/**/*.css'])
.pipe(dest(STYLES_DESTINATION))
.pipe(print())
const copy_css = () => {
return src(DISTRIBUTION_STYLES, {
allowEmpty: true,
})
.pipe(dest(PUBLIC_STYLES))
.pipe(print())
}

const fnc_scripts_copy = function () {
return src([SCRIPTS_DISTRIBUTION + '/**/*.js'])
.pipe(dest(SCRIPTS_DESTINATION))
.pipe(print())
const copy_js = () => {
return src(DISTRIBUTION_SCRIPTS, {
allowEmpty: true,
})
.pipe(dest(PUBLIC_SCRIPTS))
.pipe(print())
}

module.exports.styles_copy = fnc_styles_copy
module.exports.scripts_copy = fnc_scripts_copy
module.exports.copy = parallel(fnc_styles_copy, fnc_scripts_copy)
module.exports.copy = parallel(copy_css, copy_js)
17 changes: 17 additions & 0 deletions .gulp/html.js
@@ -0,0 +1,17 @@
const config = require('config')
const { src, dest } = require('gulp')
const fileinclude = require('gulp-file-include')

const SOURCE_VIEWS = config.get('source.views')
const DESTINATION_VIEWS = config.get('destination.views')

module.exports.html = () => {
return src(SOURCE_VIEWS)
.pipe(
fileinclude({
prefix: '@@',
basepath: '@file',
})
)
.pipe(dest(DESTINATION_VIEWS))
}
114 changes: 56 additions & 58 deletions .gulp/scripts.js
@@ -1,66 +1,64 @@
const { dest, src, parallel } = require('gulp')
const concat = require('gulp-concat')
const touch = require('gulp-touch-fd')
const config = require('config')
const uglify = require('gulp-uglify-es').default
const { src, dest, parallel, series } = require('gulp')
const concat = require('gulp-concat')
const babel = require('gulp-babel')
const { getFiles } = require('./_tools')

const SCRIPTS_BASE = config.get('gulp.scripts.base')
const SCRIPTS_DISTRIBUTION = config.get('gulp.scripts.distribution')
const ALPINEJS_BASE = config.get('gulp.alpinejs.base')
const ALPINEJS_DISTRIBUTION = config.get('gulp.alpinejs.distribution')
const minify = require('gulp-minify')

const scripts_bundle = getFiles(SCRIPTS_BASE)
scripts_bundle.forEach((obj) => {
obj.dest = SCRIPTS_DISTRIBUTION
})
const SOURCE_ALPINE = config.get('source.alpine_js')
const NAME_ALPINE = config.get('name.alpine_js')
const DESTINATION_ALPINE = config.get('destination.alpine_js')

const scripts_alpinejs = getFiles(ALPINEJS_BASE)
scripts_alpinejs.forEach((obj) => {
scripts_bundle.push({
src: obj.src,
name: obj.name,
dest: ALPINEJS_DISTRIBUTION,
})
})
const SOURCE_PLUGIN_JS = config.get('source.plugin_js')
const NAME_PLUGIN_JS = config.get('name.plugin_js')
const DESTINATION_PLUGIN_JS = config.get('destination.plugin_js')

const fnc_scripts_develop = new Array()
const fnc_scripts_build = new Array()
const SOURCE_PLUGIN_ALPINE_JS = config.get('source.plugin_alpine_js')
const NAME_PLUGIN_ALPINE_JS = config.get('name.plugin_alpine_js')
const DESTINATION_PLUGIN_ALPINE_JS = config.get('destination.plugin_alpine_js')

scripts_bundle.forEach((obj) => {
fnc_scripts_develop.push(function scripts_develop() {
return src(obj.src)
.pipe(concat(obj.name))
.pipe(
babel({
presets: ['@babel/env'],
})
)
.pipe(dest(obj.dest))
.pipe(touch())
})
fnc_scripts_build.push(function scripts_build() {
return src(obj.src)
.pipe(concat(obj.name))
.pipe(
babel({
presets: ['@babel/env'],
})
)
.pipe(uglify())
.pipe(dest(obj.dest))
.pipe(touch())
})
})

if (fnc_scripts_develop.length > 1) {
module.exports.scripts_develop = parallel(fnc_scripts_develop)
} else {
module.exports.scripts_develop = fnc_scripts_develop
const alpine_js = () => {
return src(SOURCE_ALPINE)
.pipe(concat(NAME_ALPINE))
.pipe(
minify({
ext: {
min: '.min.js',
},
ignoreFiles: ['.min.js'],
})
)
.pipe(dest(DESTINATION_ALPINE))
}
const ta_script = () => {
return src(SOURCE_PLUGIN_JS)
.pipe(
babel({
presets: ['@babel/env'],
})
)
.pipe(concat(NAME_PLUGIN_JS))
.pipe(
minify({
ext: {
min: '.min.js',
},
ignoreFiles: ['.min.js'],
})
)
.pipe(dest(DESTINATION_PLUGIN_JS))
}
if (fnc_scripts_build.length > 1) {
module.exports.scripts_build = parallel(fnc_scripts_build)
} else {
module.exports.scripts_build = fnc_scripts_build
const ta_script_alpine = () => {
return src(SOURCE_PLUGIN_ALPINE_JS)
.pipe(concat(NAME_PLUGIN_ALPINE_JS))
.pipe(
minify({
ext: {
min: '.min.js',
},
ignoreFiles: ['.min.js'],
})
)
.pipe(dest(DESTINATION_PLUGIN_ALPINE_JS))
}

module.exports.scripts = series(parallel(alpine_js, ta_script), ta_script_alpine)

0 comments on commit 2feb29a

Please sign in to comment.