Skip to content

Commit

Permalink
CSS is now done via SASS/Grunt - added all required resources for thi…
Browse files Browse the repository at this point in the history
…s update
  • Loading branch information
stefangabos committed May 15, 2022
1 parent 5c235da commit 5e31125
Show file tree
Hide file tree
Showing 40 changed files with 5,371 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

/docs export-ignore
/.github export-ignore
/src export-ignore
/node_modules export-ignore
.gitattributes export-ignore
.gitignore export-ignore
composer.json export-ignore
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/*
226 changes: 226 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
'use strict';

module.exports = function(grunt) {

// show time spent on each task
require('time-grunt')(grunt);

// required for sass
const sass = require('node-sass');

grunt.initConfig({

// load packages.json
pkg: grunt.file.readJSON('package.json'),

/***************************************************************************************************************
* NOTIFY
* https://github.com/dylang/grunt-notify
**************************************************************************************************************/
'notify': {
done: {
options: {
title: 'Grunt ',
message: 'All tasks were successfully completed!'
}
}
},

/***************************************************************************************************************
* SASS
* https://www.npmjs.org/package/grunt-sass
**************************************************************************************************************/
'sass': {
expanded: {
options: {
implementation: sass,
outputStyle: 'expanded',
indentWidth: 4
},
files: {
'public/css/default/zebra_database.css': 'src/css/default/zebra_database.scss',
}
},
minified: {
options: {
implementation: sass,
outputStyle: 'compressed'
},
files: {
'public/css/default/zebra_database.min.css': 'src/css/default/zebra_database.scss',
}
}
},

/***************************************************************************************************************
* CSSMIN
* https://github.com/gruntjs/grunt-contrib-cssmin
**************************************************************************************************************/
'cssmin': {
beutify: {
options: {
compatibility: {
properties: {
ieBangHack: true,
ieFilters: true,
iePrefixHack: true,
ieSuffixHack: true
},
selectors: {
ie7Hack: true
}
},
format: {
breaks: {
afterAtRule: true,
afterBlockBegins: true,
afterBlockEnds: true,
afterComment: true,
afterProperty: true,
afterRuleBegins: true,
afterRuleEnds: true,
beforeBlockEnds: true,
betweenSelectors: true
},
indentBy: 4,
indentWith: 'space',
spaces: {
aroundSelectorRelation: true,
beforeBlockBegins: true,
beforeValue: true
}
},
level: 2
},
files: {
'public/css/default/zebra_database.css': 'public/css/default/zebra_database.css',
}
},
minify: {
options: {
compatibility: {
properties: {
ieBangHack: true,
ieFilters: true,
iePrefixHack: true,
ieSuffixHack: true
},
selectors: {
ie7Hack: true
}
},
level: 2
},
files: {
'public/css/default/zebra_database.min.css': 'public/css/default/zebra_database.min.css',
}
}
},

/***************************************************************************************************************
* ESLINT
* http://eslint.org/docs/rules/
**************************************************************************************************************/
'eslint' : {
options: {
overrideConfigFile: 'eslint.json'
},
src: ['src/zebra_database.src.js']
},

/***************************************************************************************************************
* JSHINT
* https://npmjs.org/package/grunt-contrib-jshint
**************************************************************************************************************/
'jshint': {
options: {
strict: true, // requires all functions to run in ECMAScript 5's strict mode
asi: false, // suppresses warnings about missing semicolons
globals: { // white list of global variables that are not formally defined in the source code
'$': true,
'console': true,
'jQuery': true
},
browser: true, // defines globals exposed by modern browsers (like `document` and `navigator`)
bitwise: true, // prohibits the use of bitwise operators such as ^ (XOR), | (OR) and others
curly: false, // whether to always put curly braces around blocks in loops and conditionals
eqeqeq: true, // this options prohibits the use of == and != in favor of === and !==
freeze: true, // this options prohibits overwriting prototypes of native objects such as Array, Date and so on
scripturl: true, // allow use of scripts
nonew: true, // this option prohibits the use of constructor functions without assigning them to a variable
loopfunc: true, // allow functions to be defined inside loops
undef: true // this option prohibits the use of explicitly undeclared variables
},
src: ['src/zebra_database.src.js']
},

/***************************************************************************************************************
* UGLIFY
* https://npmjs.org/package/grunt-contrib-uglify
**************************************************************************************************************/
'uglify': {
options: {
compress: true,
mangle: true,
beautify: false
},
build: {
src: 'src/zebra_database.src.js',
dest: 'public/javascript/zebra_database.min.js'
}
},

/***************************************************************************************************************
* COPY
* https://github.com/gruntjs/grunt-contrib-copy
**************************************************************************************************************/
'copy': {
js: {
files: [
{ src: 'src/zebra_database.src.js', dest: 'public/javascript/zebra_database.src.js' }
]
},
css: {
files: [
{ expand: true, cwd: 'src/css/default/', src: ['*.png', '*.scss', '*.txt'], dest: 'public/css/default/' }
]
}
},

/***************************************************************************************************************
* WATCH
* https://npmjs.org/package/grunt-contrib-watch
**************************************************************************************************************/
'watch': {
js: {
files: ['src/zebra_database.src.js'],
tasks: ['newer:eslint', 'newer:jshint', 'newer:uglify', 'copy:js', 'notify:done'],
options: {
livereload: true
}
},
css: {
files: ['src/css/**/*.scss'],
tasks: ['sass', 'cssmin', 'copy:css', 'notify:done'],
options: {
livereload: true
}
}
}

});

// register plugins
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-newer');
grunt.loadNpmTasks('grunt-notify');
grunt.loadNpmTasks('grunt-sass');

grunt.registerTask('default', ['sass', 'cssmin', 'eslint', 'jshint', 'uglify', 'copy', 'watch']);

};
9 changes: 3 additions & 6 deletions Zebra_Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -4623,7 +4623,7 @@ function _show_debugging_console() {
if (isset($debug_info['query']) )

$output .= '
<div class="zdc-box">' .
<div class="zdc-box zdc-syntax-highlight">' .
preg_replace('/^\<br\>/', '', html_entity_decode($debug_info['query'])) . '
</div>
';
Expand Down Expand Up @@ -4766,7 +4766,6 @@ function _show_debugging_console() {
// wrap up actions bar
$output .= '
</ul>
<div class="clear"></div>
</div>
';

Expand Down Expand Up @@ -4851,7 +4850,6 @@ function _show_debugging_console() {
// finish building the submenu
$output .= '
</ul>
<div class="clear"></div>
</div>
';

Expand Down Expand Up @@ -4950,7 +4948,6 @@ function _show_debugging_console() {
// wrap up debugging console's menu
$output .= '
</ul>
<div class="clear"></div>
';

foreach (array_keys($blocks) as $block) $output .= $blocks[$block]['generated'];
Expand Down Expand Up @@ -4980,10 +4977,10 @@ function _show_debugging_console() {
$path = rtrim(preg_replace('/\\\/', '/', '//' . $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : '') . DIRECTORY_SEPARATOR . substr(dirname(__FILE__), strlen(realpath($_SERVER['DOCUMENT_ROOT'])))), '/');

// link the required javascript
$output = '<script type="text/javascript" src="' . $path . '/public/javascript/database.js"></script>' . $output;
$output = '<script type="text/javascript" src="' . $path . '/public/javascript/zebra_database.min.js"></script>' . $output;

// link the required css file
$output = '<link rel="stylesheet" href="' . $path . '/public/css/database.css" type="text/css">' . $output;
$output = '<link rel="stylesheet" href="' . $path . '/public/css/default/zebra_database.min.css" type="text/css">' . $output;

// show generated output
echo $output;
Expand Down
110 changes: 110 additions & 0 deletions eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"env": {
"browser": true
},
"globals": {
"$": true
},
"rules": {
"array-bracket-spacing": ["warn", "never"],
"block-scoped-var": 1,
"block-spacing": ["warn", "always"],
"brace-style": ["warn", "1tbs", { "allowSingleLine": true }],
"comma-dangle": 1,
"comma-spacing": ["warn", {
"before": false,
"after": true
}],
"comma-style": ["warn", "last"],
"computed-property-spacing": ["warn", "never"],
"curly": ["warn", "multi"],
"dot-location": ["warn", "property"],
"eol-last": ["warn", "always"],
"indent": ["warn", 4, {
"SwitchCase": 1,
"ignoreComments": true
}],
"keyword-spacing": ["warn", {
"before": true,
"after": true
}],
"func-call-spacing": ["warn", "never"],
"key-spacing": ["warn", {
"beforeColon": false,
"mode": "minimum"
}],
"lines-around-comment": ["warn", {
"beforeBlockComment": true,
"afterBlockComment": false
}],
"quotes": ["warn", "single"],
"newline-after-var": ["warn", "always"],
"newline-before-return": 1,
"no-console": 1,
"no-dupe-args": 1,
"no-dupe-keys": 1,
"no-duplicate-case": 1,
"no-else-return": 1,
"no-empty": 1,
"no-extra-semi": 1,
"no-fallthrough": 1,
"no-func-assign": 1,
"no-inner-declarations": ["warn", "functions"],
"no-irregular-whitespace": ["warn", {
"skipStrings": false,
"skipComments": false,
"skipRegExps": false,
"skipTemplates": false
}],
"no-lonely-if": 1,
"no-mixed-spaces-and-tabs": 1,
"no-multi-spaces": ["warn", {
"ignoreEOLComments": true
}],
"no-multiple-empty-lines": ["warn", {
"max": 1,
"maxEOF": 1,
"maxBOF": 0
}],
"no-redeclare": 1,
"no-tabs": 1,
"no-trailing-spaces": ["warn", {
"skipBlankLines": false
}],
"no-unexpected-multiline": 1,
"no-unneeded-ternary": ["warn", {
"defaultAssignment": false
}],
"no-unused-vars": [1, {
"vars": "all",
"args": "after-used",
"varsIgnorePattern": "[$]this"
}],
"no-useless-concat": 1,
"no-whitespace-before-property": 1,
"object-curly-spacing": ["warn", "never"],
"object-property-newline": ["warn", {
"allowMultiplePropertiesPerLine": false
}],
"one-var": ["warn", "always"],
"radix": ["warn", "always"],
"semi-spacing": ["warn", {
"before": false,
"after": true
}],
"space-before-blocks": ["warn", "always"],
"space-before-function-paren": ["warn", "never"],
"space-in-parens": ["warn", "never"],
"space-infix-ops": 1,
"space-unary-ops": ["warn", {
"words": true,
"nonwords": false
}],
"spaced-comment": ["warn", "always", {
"exceptions": ["-", "+", "*", "=", "_"]
}],
"use-isnan": 1,
"valid-typeof": 1,
"wrap-iife": ["warn", "inside"]
}
}
Loading

0 comments on commit 5e31125

Please sign in to comment.