Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added minified CSS #3073

Merged
merged 11 commits into from Oct 4, 2021
3 changes: 2 additions & 1 deletion assets/download.js
Expand Up @@ -181,8 +181,9 @@

if ((!all[id].noCSS && !/\.js$/.test(filepath)) || /\.css$/.test(filepath)) {
var cssFile = filepath.replace(/(\.css)?$/, '.css');
var minCSSFile = cssFile.replace(/(?:\.css)$/, '.min.css');

info.files.minified.paths.push(cssFile);
info.files.minified.paths.push(minCSSFile);
info.files.dev.paths.push(cssFile);
}

Expand Down
12 changes: 9 additions & 3 deletions gulpfile.js/index.js
Expand Up @@ -7,6 +7,7 @@ const uglify = require('gulp-uglify');
const header = require('gulp-header');
const concat = require('gulp-concat');
const replace = require('gulp-replace');
const cleanCSS = require('gulp-clean-css');
RunDevelopment marked this conversation as resolved.
Show resolved Hide resolved
const webfont = require('webfont').default;
const pump = require('pump');
const util = require('util');
Expand Down Expand Up @@ -70,6 +71,12 @@ function minifyComponents(cb) {
function minifyPlugins(cb) {
pump([src(paths.plugins), ...minifyJS(), rename({ suffix: '.min' }), dest('plugins')], cb);
}
function minifyPluginCSS(cb) {
pump([src(paths.pluginsCSS), cleanCSS(), rename({ suffix: '.min' }), dest('plugins')], cb);
}
function minifyThemes(cb) {
pump([src(paths.themes), cleanCSS(), rename({ suffix: '.min' }), dest('themes')], cb);
}
function build(cb) {
pump([src(paths.main), header(`
/* **********************************************
Expand Down Expand Up @@ -278,12 +285,11 @@ async function treeviewIconFont() {
}

const components = minifyComponents;
const plugins = series(languagePlugins, treeviewIconFont, minifyPlugins);

const plugins = series(languagePlugins, treeviewIconFont, minifyPlugins, minifyPluginCSS);

module.exports = {
watch: watchComponentsAndPlugins,
default: series(parallel(components, plugins, componentsJsonToJs, build), docs),
default: series(parallel(components, plugins, minifyThemes, componentsJsonToJs, build), docs),
linkify,
changes
};
2 changes: 2 additions & 0 deletions gulpfile.js/paths.js
Expand Up @@ -4,6 +4,7 @@ module.exports = {
componentsFile: 'components.json',
componentsFileJS: 'components.js',
components: ['components/**/*.js', '!components/index.js', '!components/**/*.min.js'],
themes: ['themes/*.css', '!themes/*.min.css'],
main: [
'components/prism-core.js',
'components/prism-markup.js',
Expand All @@ -13,6 +14,7 @@ module.exports = {
'plugins/file-highlight/prism-file-highlight.js'
],
plugins: ['plugins/**/*.js', '!plugins/**/*.min.js'],
pluginsCSS: ['plugins/**/*.css', '!plugins/**/*.min.css'],
showLanguagePlugin: 'plugins/show-language/prism-show-language.js',
autoloaderPlugin: 'plugins/autoloader/prism-autoloader.js',
changelog: 'CHANGELOG.md'
Expand Down
52 changes: 52 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -44,6 +44,7 @@
"eslint-plugin-jsdoc": "^32.3.0",
"eslint-plugin-regexp": "^1.2.0",
"gulp": "^4.0.2",
"gulp-clean-css": "^4.3.0",
"gulp-concat": "^2.3.4",
"gulp-header": "^2.0.7",
"gulp-jsdoc3": "^3.0.0",
Expand Down
1 change: 1 addition & 0 deletions plugins/autolinker/prism-autolinker.min.css
@@ -0,0 +1 @@
.token a{color:inherit}
1 change: 1 addition & 0 deletions plugins/command-line/prism-command-line.min.css

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

1 change: 1 addition & 0 deletions plugins/diff-highlight/prism-diff-highlight.min.css

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

1 change: 1 addition & 0 deletions plugins/inline-color/prism-inline-color.min.css

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

1 change: 1 addition & 0 deletions plugins/line-highlight/prism-line-highlight.min.css

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

1 change: 1 addition & 0 deletions plugins/line-numbers/prism-line-numbers.min.css

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

1 change: 1 addition & 0 deletions plugins/match-braces/prism-match-braces.min.css

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

1 change: 1 addition & 0 deletions plugins/previewers/prism-previewers.min.css

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

1 change: 1 addition & 0 deletions plugins/show-invisibles/prism-show-invisibles.min.css

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

1 change: 1 addition & 0 deletions plugins/toolbar/prism-toolbar.min.css

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