forked from p85947160/gitea
Update fomantic-ui to 2.8.5 (#11736)
Update to [2.8.5](https://github.com/fomantic/Fomantic-UI/releases/tag/2.8.5) and remove the workaround for the CSS build race condition. Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
a3b185d54c
commit
3affe9516a
3
Makefile
3
Makefile
|
@ -107,7 +107,7 @@ endif
|
|||
|
||||
GO_SOURCES_OWN := $(filter-out vendor/% %/bindata.go, $(GO_SOURCES))
|
||||
|
||||
FOMANTIC_CONFIGS := semantic.json web_src/fomantic/theme.config.less web_src/fomantic/_site/globals/site.variables web_src/fomantic/css.js
|
||||
FOMANTIC_CONFIGS := semantic.json web_src/fomantic/theme.config.less web_src/fomantic/_site/globals/site.variables
|
||||
FOMANTIC_DEST := public/fomantic/semantic.min.js public/fomantic/semantic.min.css
|
||||
FOMANTIC_DEST_DIR := public/fomantic
|
||||
|
||||
|
@ -591,7 +591,6 @@ $(FOMANTIC_DEST): $(FOMANTIC_CONFIGS) package-lock.json | node_modules
|
|||
rm -rf $(FOMANTIC_DEST_DIR)
|
||||
cp web_src/fomantic/theme.config.less node_modules/fomantic-ui/src/theme.config
|
||||
cp -r web_src/fomantic/_site/* node_modules/fomantic-ui/src/_site/
|
||||
cp web_src/fomantic/css.js node_modules/fomantic-ui/tasks/build/css.js
|
||||
npx gulp -f node_modules/fomantic-ui/gulpfile.js build
|
||||
@touch $(FOMANTIC_DEST)
|
||||
|
||||
|
|
|
@ -897,19 +897,19 @@
|
|||
}
|
||||
},
|
||||
"@octokit/auth-token": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.0.tgz",
|
||||
"integrity": "sha512-eoOVMjILna7FVQf96iWc3+ZtE/ZT6y8ob8ZzcqKY1ibSQCnu4O/B7pJvzMx5cyZ/RjAff6DAdEb0O0Cjcxidkg==",
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.1.tgz",
|
||||
"integrity": "sha512-NB81O5h39KfHYGtgfWr2booRxp2bWOJoqbWwbyUg2hw6h35ArWYlAST5B3XwAkbdcx13yt84hFXyFP5X0QToWA==",
|
||||
"requires": {
|
||||
"@octokit/types": "^2.0.0"
|
||||
"@octokit/types": "^4.0.1"
|
||||
}
|
||||
},
|
||||
"@octokit/endpoint": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.1.tgz",
|
||||
"integrity": "sha512-pOPHaSz57SFT/m3R5P8MUu4wLPszokn5pXcB/pzavLTQf2jbU+6iayTvzaY6/BiotuRS0qyEUkx3QglT4U958A==",
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.2.tgz",
|
||||
"integrity": "sha512-xs1mmCEZ2y4shXCpFjNq3UbmNR+bLzxtZim2L0zfEtj9R6O6kc4qLDvYw66hvO6lUsYzPTM5hMkltbuNAbRAcQ==",
|
||||
"requires": {
|
||||
"@octokit/types": "^2.11.1",
|
||||
"@octokit/types": "^4.0.1",
|
||||
"is-plain-object": "^3.0.0",
|
||||
"universal-user-agent": "^5.0.0"
|
||||
},
|
||||
|
@ -930,6 +930,16 @@
|
|||
"integrity": "sha512-jbsSoi5Q1pj63sC16XIUboklNw+8tL9VOnJsWycWYR78TKss5PVpIPb1TUUcMQ+bBh7cY579cVAWmf5qG+dw+Q==",
|
||||
"requires": {
|
||||
"@octokit/types": "^2.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@octokit/types": {
|
||||
"version": "2.16.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.16.2.tgz",
|
||||
"integrity": "sha512-O75k56TYvJ8WpAakWwYRN8Bgu60KrmX0z1KqFp1kNiFNkgW+JW+9EBKZ+S33PU6SLvbihqd+3drvPxKK68Ee8Q==",
|
||||
"requires": {
|
||||
"@types/node": ">= 8"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@octokit/plugin-request-log": {
|
||||
|
@ -944,16 +954,26 @@
|
|||
"requires": {
|
||||
"@octokit/types": "^2.0.1",
|
||||
"deprecation": "^2.3.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@octokit/types": {
|
||||
"version": "2.16.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.16.2.tgz",
|
||||
"integrity": "sha512-O75k56TYvJ8WpAakWwYRN8Bgu60KrmX0z1KqFp1kNiFNkgW+JW+9EBKZ+S33PU6SLvbihqd+3drvPxKK68Ee8Q==",
|
||||
"requires": {
|
||||
"@types/node": ">= 8"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@octokit/request": {
|
||||
"version": "5.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.2.tgz",
|
||||
"integrity": "sha512-zKdnGuQ2TQ2vFk9VU8awFT4+EYf92Z/v3OlzRaSh4RIP0H6cvW1BFPXq4XYvNez+TPQjqN+0uSkCYnMFFhcFrw==",
|
||||
"version": "5.4.4",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.4.tgz",
|
||||
"integrity": "sha512-vqv1lz41c6VTxUvF9nM+a6U+vvP3vGk7drDpr0DVQg4zyqlOiKVrY17DLD6de5okj+YLHKcoqaUZTBtlNZ1BtQ==",
|
||||
"requires": {
|
||||
"@octokit/endpoint": "^6.0.1",
|
||||
"@octokit/request-error": "^2.0.0",
|
||||
"@octokit/types": "^2.11.1",
|
||||
"@octokit/types": "^4.0.1",
|
||||
"deprecation": "^2.0.0",
|
||||
"is-plain-object": "^3.0.0",
|
||||
"node-fetch": "^2.3.0",
|
||||
|
@ -962,11 +982,11 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@octokit/request-error": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.0.tgz",
|
||||
"integrity": "sha512-rtYicB4Absc60rUv74Rjpzek84UbVHGHJRu4fNVlZ1mCcyUPPuzFfG9Rn6sjHrd95DEsmjSt1Axlc699ZlbDkw==",
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.1.tgz",
|
||||
"integrity": "sha512-5lqBDJ9/TOehK82VvomQ6zFiZjPeSom8fLkFVLuYL3sKiIb5RB8iN/lenLkY7oBmyQcGP7FBMGiIZTO8jufaRQ==",
|
||||
"requires": {
|
||||
"@octokit/types": "^2.0.0",
|
||||
"@octokit/types": "^4.0.1",
|
||||
"deprecation": "^2.0.0",
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
|
@ -989,6 +1009,16 @@
|
|||
"@octokit/types": "^2.0.0",
|
||||
"deprecation": "^2.0.0",
|
||||
"once": "^1.4.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@octokit/types": {
|
||||
"version": "2.16.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.16.2.tgz",
|
||||
"integrity": "sha512-O75k56TYvJ8WpAakWwYRN8Bgu60KrmX0z1KqFp1kNiFNkgW+JW+9EBKZ+S33PU6SLvbihqd+3drvPxKK68Ee8Q==",
|
||||
"requires": {
|
||||
"@types/node": ">= 8"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@octokit/rest": {
|
||||
|
@ -1015,9 +1045,9 @@
|
|||
}
|
||||
},
|
||||
"@octokit/types": {
|
||||
"version": "2.16.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.16.2.tgz",
|
||||
"integrity": "sha512-O75k56TYvJ8WpAakWwYRN8Bgu60KrmX0z1KqFp1kNiFNkgW+JW+9EBKZ+S33PU6SLvbihqd+3drvPxKK68Ee8Q==",
|
||||
"version": "4.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-4.1.4.tgz",
|
||||
"integrity": "sha512-W+aHUBA6pEZ8OC1fgfFW1/jrgtkaMVBhNr7jhhBErvbWQY4Ii9Hlf3LAurwcy5XXjz8EYluiCZjHhnQO4GSfNg==",
|
||||
"requires": {
|
||||
"@types/node": ">= 8"
|
||||
}
|
||||
|
@ -1070,9 +1100,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "14.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.1.tgz",
|
||||
"integrity": "sha512-FAYBGwC+W6F9+huFIDtn43cpy7+SzG+atzRiTfdp3inUKL2hXnd4rG8hylJLIh4+hqrQy1P17kvJByE/z825hA=="
|
||||
"version": "14.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.9.tgz",
|
||||
"integrity": "sha512-0sCTiXKXELOBxvZLN4krQ0FPOAA7ij+6WwvD0k/PHd9/KAkr4dXel5J9fh6F4x1FwAQILqAWkmpeuS6mjf1iKA=="
|
||||
},
|
||||
"@types/normalize-package-data": {
|
||||
"version": "2.4.0",
|
||||
|
@ -2110,9 +2140,9 @@
|
|||
"integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw=="
|
||||
},
|
||||
"binaryextensions": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-2.2.0.tgz",
|
||||
"integrity": "sha512-bHhs98rj/7i/RZpCSJ3uk55pLXOItjIrh2sRQZSM6OoktScX+LxJzvlU+FELp9j3TdcddTmmYArLSGptCTwjuw=="
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-2.3.0.tgz",
|
||||
"integrity": "sha512-nAihlQsYGyc5Bwq6+EsubvANYGExeJKHDO3RjnvwU042fawQTQfM3Kxn7IHUXQOz4bzfwsGYYHGSvXyW4zOGLg=="
|
||||
},
|
||||
"bindings": {
|
||||
"version": "1.5.0",
|
||||
|
@ -5173,9 +5203,9 @@
|
|||
}
|
||||
},
|
||||
"fomantic-ui": {
|
||||
"version": "2.8.4",
|
||||
"resolved": "https://registry.npmjs.org/fomantic-ui/-/fomantic-ui-2.8.4.tgz",
|
||||
"integrity": "sha512-We34raC+xqoaIOFFamsN8cHc+tCNy+6JWjWmkWIEjeIxZRrbXsoqto8eLFjMIPEwL1C6H0FwONqt39AmL+8zeg==",
|
||||
"version": "2.8.5",
|
||||
"resolved": "https://registry.npmjs.org/fomantic-ui/-/fomantic-ui-2.8.5.tgz",
|
||||
"integrity": "sha512-VvnralD84d6sRfp/FYYURLeNXi7QeKfLje5En2MNGRFRfR3t+J3KEPSk7g8NBP4KJWsW3Hr8Lne0p9ErA05aug==",
|
||||
"requires": {
|
||||
"@octokit/rest": "^16.16.0",
|
||||
"better-console": "1.0.1",
|
||||
|
@ -5584,9 +5614,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"gulp-cli": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/gulp-cli/-/gulp-cli-2.2.0.tgz",
|
||||
"integrity": "sha512-rGs3bVYHdyJpLqR0TUBnlcZ1O5O++Zs4bA0ajm+zr3WFCfiSLjGwoCBqFs18wzN+ZxahT9DkOK5nDf26iDsWjA==",
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/gulp-cli/-/gulp-cli-2.2.1.tgz",
|
||||
"integrity": "sha512-yEMxrXqY8mJFlaauFQxNrCpzWJThu0sH1sqlToaTOT063Hub9s/Nt2C+GSLe6feQ/IMWrHvGOOsyES7CQc9O+A==",
|
||||
"requires": {
|
||||
"ansi-colors": "^1.0.1",
|
||||
"archy": "^1.0.0",
|
||||
|
@ -6397,9 +6427,9 @@
|
|||
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8="
|
||||
},
|
||||
"uglify-js": {
|
||||
"version": "3.9.3",
|
||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.9.3.tgz",
|
||||
"integrity": "sha512-r5ImcL6QyzQGVimQoov3aL2ZScywrOgBXGndbWrdehKoSvGe/RmiE5Jpw/v+GvxODt6l2tpBXwA7n+qZVlHBMA==",
|
||||
"version": "3.9.4",
|
||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.9.4.tgz",
|
||||
"integrity": "sha512-8RZBJq5smLOa7KslsNsVcSH+KOXf1uDU8yqLeNuVKwmT0T3FA0ZoXlinQfRad7SDcbZZRZE4ov+2v71EnxNyCA==",
|
||||
"requires": {
|
||||
"commander": "~2.20.3"
|
||||
}
|
||||
|
@ -14101,9 +14131,9 @@
|
|||
"integrity": "sha512-CNmdbwQMBjwr9Gsmohvm0pbL954tJrNzf6gWL3K+QMQf00PF7ERGrEiLgjuU3mKreLC2MeGhUsNV9ybTbLgd3w=="
|
||||
},
|
||||
"v8flags": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.3.tgz",
|
||||
"integrity": "sha512-amh9CCg3ZxkzQ48Mhcb8iX7xpAfYJgePHxWMQCBWECpOSqJUXgY26ncA61UTV0BkPqfhcy6mzwCIoP4ygxpW8w==",
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz",
|
||||
"integrity": "sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==",
|
||||
"requires": {
|
||||
"homedir-polyfill": "^1.0.1"
|
||||
}
|
||||
|
@ -14989,9 +15019,9 @@
|
|||
}
|
||||
},
|
||||
"yargs": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz",
|
||||
"integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=",
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.1.tgz",
|
||||
"integrity": "sha512-huO4Fr1f9PmiJJdll5kwoS2e4GqzGSsMT3PPMpOwoVkOK8ckqAewMTZyA6LXVQWflleb/Z8oPBEvNsMft0XE+g==",
|
||||
"requires": {
|
||||
"camelcase": "^3.0.0",
|
||||
"cliui": "^3.2.0",
|
||||
|
@ -15005,7 +15035,7 @@
|
|||
"string-width": "^1.0.2",
|
||||
"which-module": "^1.0.0",
|
||||
"y18n": "^3.2.1",
|
||||
"yargs-parser": "^5.0.0"
|
||||
"yargs-parser": "5.0.0-security.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"camelcase": {
|
||||
|
@ -15016,11 +15046,12 @@
|
|||
}
|
||||
},
|
||||
"yargs-parser": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz",
|
||||
"integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=",
|
||||
"version": "5.0.0-security.0",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0-security.0.tgz",
|
||||
"integrity": "sha512-T69y4Ps64LNesYxeYGYPvfoMTt/7y1XtfpIslUeK4um+9Hu7hlGoRtaDLvdXb7+/tfq4opVa2HRY5xGip022rQ==",
|
||||
"requires": {
|
||||
"camelcase": "^3.0.0"
|
||||
"camelcase": "^3.0.0",
|
||||
"object.assign": "^4.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"camelcase": {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"dropzone": "5.7.0",
|
||||
"fast-glob": "3.2.2",
|
||||
"file-loader": "6.0.0",
|
||||
"fomantic-ui": "2.8.4",
|
||||
"fomantic-ui": "2.8.5",
|
||||
"highlight.js": "10.0.3",
|
||||
"imports-loader": "0.8.0",
|
||||
"jquery": "3.5.1",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "2.8.4",
|
||||
"version": "2.8.5",
|
||||
"base": "node_modules/fomantic-ui",
|
||||
"paths": {
|
||||
"source": {
|
||||
|
|
|
@ -1,260 +0,0 @@
|
|||
/*******************************
|
||||
* Build Task
|
||||
*******************************/
|
||||
|
||||
const
|
||||
gulp = require('gulp'),
|
||||
|
||||
// node dependencies
|
||||
console = require('better-console'),
|
||||
|
||||
// gulp dependencies
|
||||
autoprefixer = require('gulp-autoprefixer'),
|
||||
chmod = require('gulp-chmod'),
|
||||
concatCSS = require('gulp-concat-css'),
|
||||
dedupe = require('gulp-dedupe'),
|
||||
flatten = require('gulp-flatten'),
|
||||
gulpif = require('gulp-if'),
|
||||
header = require('gulp-header'),
|
||||
less = require('gulp-less'),
|
||||
minifyCSS = require('gulp-clean-css'),
|
||||
normalize = require('normalize-path'),
|
||||
plumber = require('gulp-plumber'),
|
||||
print = require('gulp-print').default,
|
||||
rename = require('gulp-rename'),
|
||||
replace = require('gulp-replace'),
|
||||
replaceExt = require('replace-ext'),
|
||||
rtlcss = require('gulp-rtlcss'),
|
||||
|
||||
// config
|
||||
config = require('./../config/user'),
|
||||
docsConfig = require('./../config/docs'),
|
||||
tasks = require('../config/tasks'),
|
||||
install = require('../config/project/install'),
|
||||
|
||||
// shorthand
|
||||
globs = config.globs,
|
||||
assets = config.paths.assets,
|
||||
|
||||
banner = tasks.banner,
|
||||
filenames = tasks.filenames,
|
||||
comments = tasks.regExp.comments,
|
||||
log = tasks.log,
|
||||
settings = tasks.settings
|
||||
;
|
||||
|
||||
/**
|
||||
* Builds the css
|
||||
* @param src
|
||||
* @param type
|
||||
* @param compress
|
||||
* @param config
|
||||
* @param opts
|
||||
* @return {*}
|
||||
*/
|
||||
function build(src, type, compress, config, opts) {
|
||||
let fileExtension;
|
||||
if (type === 'rtl' && compress) {
|
||||
fileExtension = settings.rename.rtlMinCSS;
|
||||
} else if (type === 'rtl') {
|
||||
fileExtension = settings.rename.rtlCSS;
|
||||
} else if (compress) {
|
||||
fileExtension = settings.rename.minCSS;
|
||||
}
|
||||
|
||||
return gulp.src(src, opts)
|
||||
.pipe(plumber(settings.plumber.less))
|
||||
.pipe(less(settings.less))
|
||||
.pipe(autoprefixer(settings.prefix))
|
||||
.pipe(gulpif(type === 'rtl', rtlcss()))
|
||||
.pipe(replace(comments.variables.in, comments.variables.out))
|
||||
.pipe(replace(comments.license.in, comments.license.out))
|
||||
.pipe(replace(comments.large.in, comments.large.out))
|
||||
.pipe(replace(comments.small.in, comments.small.out))
|
||||
.pipe(replace(comments.tiny.in, comments.tiny.out))
|
||||
.pipe(flatten())
|
||||
.pipe(replace(config.paths.assets.source,
|
||||
compress ? config.paths.assets.compressed : config.paths.assets.uncompressed))
|
||||
.pipe(gulpif(compress, minifyCSS(settings.minify)))
|
||||
.pipe(gulpif(fileExtension, rename(fileExtension)))
|
||||
.pipe(gulpif(config.hasPermissions, chmod(config.parsedPermissions)))
|
||||
.pipe(gulp.dest(compress ? config.paths.output.compressed : config.paths.output.uncompressed))
|
||||
.pipe(print(log.created))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Packages the css files in dist
|
||||
* @param {string} type - type of the css processing (none, rtl, docs)
|
||||
* @param {boolean} compress - should the output be compressed
|
||||
*/
|
||||
function pack(type, compress) {
|
||||
const output = type === 'docs' ? docsConfig.paths.output : config.paths.output;
|
||||
const ignoredGlobs = type === 'rtl' ? globs.ignoredRTL + '.rtl.css' : globs.ignored + '.css';
|
||||
|
||||
let concatenatedCSS;
|
||||
if (type === 'rtl') {
|
||||
concatenatedCSS = compress ? filenames.concatenatedMinifiedRTLCSS : filenames.concatenatedRTLCSS;
|
||||
} else {
|
||||
concatenatedCSS = compress ? filenames.concatenatedMinifiedCSS : filenames.concatenatedCSS;
|
||||
}
|
||||
|
||||
return gulp.src(output.uncompressed + '/**/' + globs.components + ignoredGlobs)
|
||||
.pipe(plumber())
|
||||
.pipe(dedupe())
|
||||
.pipe(replace(assets.uncompressed, assets.packaged))
|
||||
.pipe(concatCSS(concatenatedCSS, settings.concatCSS))
|
||||
.pipe(gulpif(config.hasPermissions, chmod(config.parsedPermissions)))
|
||||
.pipe(gulpif(compress, minifyCSS(settings.concatMinify)))
|
||||
.pipe(header(banner, settings.header))
|
||||
.pipe(gulp.dest(output.packaged))
|
||||
.pipe(print(log.created))
|
||||
;
|
||||
}
|
||||
|
||||
function buildCSS(src, type, config, opts, callback) {
|
||||
if (!install.isSetup()) {
|
||||
console.error('Cannot build CSS files. Run "gulp install" to set-up Semantic');
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
if (callback === undefined) {
|
||||
callback = opts;
|
||||
opts = config;
|
||||
config = type;
|
||||
type = src;
|
||||
src = config.paths.source.definitions + '/**/' + config.globs.components + '.less';
|
||||
}
|
||||
|
||||
const buildUncompressed = () => build(src, type, false, config, opts);
|
||||
buildUncompressed.displayName = 'Building uncompressed CSS';
|
||||
|
||||
const buildCompressed = () => build(src, type, true, config, opts);
|
||||
buildCompressed.displayName = 'Building compressed CSS';
|
||||
|
||||
const packUncompressed = () => pack(type, false);
|
||||
packUncompressed.displayName = 'Packing uncompressed CSS';
|
||||
|
||||
const packCompressed = () => pack(type, true);
|
||||
packCompressed.displayName = 'Packing compressed CSS';
|
||||
|
||||
gulp.parallel(
|
||||
gulp.series(
|
||||
buildUncompressed,
|
||||
gulp.parallel(packUncompressed, packCompressed)
|
||||
),
|
||||
gulp.series(buildCompressed)
|
||||
)(callback);
|
||||
}
|
||||
|
||||
function rtlAndNormal(src, callback) {
|
||||
if (callback === undefined) {
|
||||
callback = src;
|
||||
src = config.paths.source.definitions + '/**/' + config.globs.components + '.less';
|
||||
}
|
||||
|
||||
const rtl = (callback) => buildCSS(src, 'rtl', config, {}, callback);
|
||||
rtl.displayName = "CSS Right-To-Left";
|
||||
const css = (callback) => buildCSS(src, 'default', config, {}, callback);
|
||||
css.displayName = "CSS";
|
||||
|
||||
if (config.rtl === true || config.rtl === 'Yes') {
|
||||
rtl(callback);
|
||||
} else if (config.rtl === 'both') {
|
||||
gulp.series(rtl, css)(callback);
|
||||
} else {
|
||||
css(callback);
|
||||
}
|
||||
}
|
||||
|
||||
function docs(src, callback) {
|
||||
if (callback === undefined) {
|
||||
callback = src;
|
||||
src = config.paths.source.definitions + '/**/' + config.globs.components + '.less';
|
||||
}
|
||||
|
||||
const func = (callback) => buildCSS(src, 'docs', config, {}, callback);
|
||||
func.displayName = "CSS Docs";
|
||||
|
||||
func(callback);
|
||||
}
|
||||
|
||||
// Default tasks
|
||||
module.exports = rtlAndNormal;
|
||||
|
||||
// We keep the changed files in an array to call build with all of them at the same time
|
||||
let timeout, files = [];
|
||||
|
||||
/**
|
||||
* Watch changes in CSS files and call the correct build pipe
|
||||
* @param type
|
||||
* @param config
|
||||
*/
|
||||
module.exports.watch = function (type, config) {
|
||||
const method = type === 'docs' ? docs : rtlAndNormal;
|
||||
|
||||
// Watch theme.config file
|
||||
gulp.watch([
|
||||
normalize(config.paths.source.config),
|
||||
normalize(config.paths.source.site + '/**/site.variables'),
|
||||
normalize(config.paths.source.themes + '/**/site.variables')
|
||||
])
|
||||
.on('all', function () {
|
||||
// Clear timeout and reset files
|
||||
timeout && clearTimeout(timeout);
|
||||
files = [];
|
||||
return gulp.series(method)();
|
||||
});
|
||||
|
||||
// Watch any less / overrides / variables files
|
||||
gulp.watch([
|
||||
normalize(config.paths.source.definitions + '/**/*.less'),
|
||||
normalize(config.paths.source.site + '/**/*.{overrides,variables}'),
|
||||
normalize(config.paths.source.themes + '/**/*.{overrides,variables}')
|
||||
])
|
||||
.on('all', function (event, path) {
|
||||
// We don't handle deleted files yet
|
||||
if (event === 'unlink' || event === 'unlinkDir') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear timeout
|
||||
timeout && clearTimeout(timeout);
|
||||
|
||||
// Determine which LESS file has to be recompiled
|
||||
let lessPath;
|
||||
if(path.indexOf('site.variables') !== -1) {
|
||||
return;
|
||||
} else if (path.indexOf(config.paths.source.themes) !== -1) {
|
||||
console.log('Change detected in packaged theme');
|
||||
lessPath = replaceExt(path, '.less');
|
||||
lessPath = lessPath.replace(tasks.regExp.theme, config.paths.source.definitions);
|
||||
} else if (path.indexOf(config.paths.source.site) !== -1) {
|
||||
console.log('Change detected in site theme');
|
||||
lessPath = replaceExt(path, '.less');
|
||||
lessPath = lessPath.replace(config.paths.source.site, config.paths.source.definitions);
|
||||
} else {
|
||||
console.log('Change detected in definition');
|
||||
lessPath = path;
|
||||
}
|
||||
|
||||
// Add file to internal changed files array
|
||||
if (!files.includes(lessPath)) {
|
||||
files.push(lessPath);
|
||||
}
|
||||
|
||||
// Update timeout
|
||||
timeout = setTimeout(() => {
|
||||
// Copy files to build in another array
|
||||
const buildFiles = [...files];
|
||||
// Call method
|
||||
gulp.series((callback) => method(buildFiles, callback))();
|
||||
// Reset internal changed files array
|
||||
files = [];
|
||||
}, 1000);
|
||||
});
|
||||
};
|
||||
|
||||
// Expose build css method
|
||||
module.exports.buildCSS = buildCSS;
|
Loading…
Reference in New Issue