Skip to content

Commit

Permalink
Merge branch 'dev' into pull-request/add-bulk-action-buttons-to-botto…
Browse files Browse the repository at this point in the history
…m-of-favorites
  • Loading branch information
demiankatz committed Jan 28, 2025
2 parents c6a3e98 + 83e0e2f commit 6d4934c
Show file tree
Hide file tree
Showing 3,132 changed files with 75 additions and 96,343 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 0 additions & 1 deletion .eslintrc.jsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ module.exports = {
"themes/bootstrap5/js/config.js",
"themes/bootstrap5/js/channels.js",
"themes/bootstrap5/js/truncate.js",
"themes/bootstrap3/**"
],
extends: [],
env: {
Expand Down
165 changes: 4 additions & 161 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = function(grunt) {
var parts = file.split('/');
parts.pop(); // eliminate filename

// initialize search path with directory containing the LESS or SCSS file
// initialize search path with directory containing the SCSS file
var retVal = [];
retVal.push(parts.join('/'));
retVal.push(parts.join('/') + '/vendor/');
Expand Down Expand Up @@ -55,36 +55,8 @@ module.exports = function(grunt) {
return retVal;
}

var fontAwesomePath = '"../../bootstrap3/css/fonts"';
var lessFileSettings = [{
expand: true,
src: "themes/*/less/compiled.less",
rename: function (dest, src) {
return src.replace('/less/', '/css/').replace('.less', '.css');
}
}];

const gruntConfig = {
// LESS compilation
less: {
compile: {
files: lessFileSettings,
options: {
paths: getLoadPaths,
compress: true,
modifyVars: {
'fa-font-path': fontAwesomePath
}
}
}
},
// Less with maps
lessdev: {
less: {
}
},
// SASS compilation
// 'scss' is also mapped to 'scssonly' below
'scss': {
'dart-sass': {
options: {
Expand All @@ -101,146 +73,23 @@ module.exports = function(grunt) {
}
},

// Convert LESS to SASS, mostly for development team use
lessToSass: {
convert: {
files: [
{
expand: true,
cwd: 'themes/bootstrap3/less',
src: ['*.less', 'components/**/*.less', 'mixins/**/*.less'],
ext: '.scss',
dest: 'themes/bootstrap3/scss'
},
{
expand: true,
cwd: 'themes/bootprint3/less',
src: ['*.less'],
ext: '.scss',
dest: 'themes/bootprint3/scss'
},
{
expand: true,
cwd: 'themes/sandal/less',
src: ['*.less'],
ext: '.scss',
dest: 'themes/sandal/scss'
}
],
options: {
excludes: ['important'],
replacements: [
// Activate SCSS
{
pattern: /\/\* #SCSS>/gi,
replacement: "/* #SCSS> */",
order: -1 // Do before anything else
},
{
pattern: /<#SCSS \*\//gi,
replacement: "/* <#SCSS */",
order: -1
},
// Deactivate LESS
{
pattern: /\/\* #LESS> \*\//gi,
replacement: "/* #LESS>",
order: -1
},
{
pattern: /\/\* <#LESS \*\//gi,
replacement: "<#LESS */",
order: -1
},
{ // Change separator in @include statements
pattern: /@include ([^\(]+)\(([^\)]+)\);/gi,
replacement: function mixinCommas(match, $1, $2) {
return '@include ' + $1 + '(' + $2.replace(/;/g, ',') + ');';
},
order: 4 // after defaults included in less-to-sass
},
{ // Remove unquote
pattern: /unquote\("([^"]+)"\)/gi,
replacement: function ununquote(match, $1) {
return $1;
},
order: 4
},
{ // Inline &:extends converted
pattern: /&:extend\(([^\)]+?)( all)?\)/gi,
replacement: '@extend $1',
order: 4
},
{ // Wrap variables in calcs with #{}
pattern: /calc\([^;]+/gi,
replacement: function calcVariables(match) {
return match.replace(/(\$[\w\-]+)/gi, '#{$1}');
},
order: 4
},
{ // Wrap variables set to css variables with #{}
pattern: /(--[\w-:]+:\s*)((\$|darken\(|lighten\()[^;]+)/gi,
replacement: '$1#{$2}',
order: 5
},
{ // Remove !default from extends (icons.scss)
pattern: /@extend ([^;}]+) !default;/gi,
replacement: '@extend $1;',
order: 6
}
]
}
}
},

watch: {
options: {
atBegin: true
},
less: {
files: 'themes/*/less/**/*.less',
tasks: ['less']
},
lessdev: {
files: 'themes/*/less/**/*.less',
tasks: ['lessdev']
},
scss: {
files: 'themes/*/scss/**/*.scss',
tasks: ['scss']
}
}
};
// scssonly compiles scss files for themes that don't use less
gruntConfig.scssonly = gruntConfig.scss;

grunt.initConfig(gruntConfig);

grunt.registerMultiTask('lessdev', function lessWithMaps() {
grunt.config.set('less', {
dev: {
files: lessFileSettings,
options: {
paths: getLoadPaths,
sourceMap: true,
sourceMapFileInline: true,
modifyVars: {
'fa-font-path': fontAwesomePath
}
}
}
});
grunt.task.run('less');
});

grunt.registerMultiTask('scss', function sassScan() {
grunt.config.set('dart-sass', getSassConfig(this.data.options, false));
grunt.task.run('dart-sass');
});
grunt.registerMultiTask('scssonly', function sassScan() {
grunt.config.set('dart-sass', getSassConfig(this.data.options, false, false));
grunt.task.run('dart-sass');
});

grunt.registerMultiTask('check:scss', function sassCheck() {
grunt.config.set('dart-sass', getSassConfig(this.data.options, true, true));
Expand All @@ -250,23 +99,17 @@ module.exports = function(grunt) {
grunt.registerTask('default', function help() {
grunt.log.writeln(`\nHello! Here are your grunt command options:
- grunt less = compile and compress all themes' LESS files to css.
- grunt scss = compile and map all themes' SASS files to css.
- grunt lessdev = compile and map all themes' LESS files to css.
- grunt check:scss = check all themes' SASS files.
- grunt watch:[cmd] = continuous monitor source files and run command when changes are detected.
- grunt watch:less
- grunt watch:scss
- grunt watch:lessdev
- grunt lessToSass = transpile all LESS files to SASS.`);
- grunt watch:scss`);
});

function getSassConfig(additionalOptions, checkOnly, themesWithLess = null) {
function getSassConfig(additionalOptions, checkOnly) {
var sassConfig = {},
path = require('path'),
themeList = fs.readdirSync(path.resolve('themes')).filter(function (theme) {
return fs.existsSync(path.resolve('themes/' + theme + '/scss/compiled.scss'))
&& (null === themesWithLess || themesWithLess === fs.existsSync(path.resolve('themes/' + theme + '/less/compiled.less')));
return fs.existsSync(path.resolve('themes/' + theme + '/scss/compiled.scss'));
});

for (var i in themeList) {
Expand Down
Loading

0 comments on commit 6d4934c

Please sign in to comment.