PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.2.4
Code Block Pro – Beautiful Syntax Highlighting v1.2.4
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / postcss.config.js

postcss.config.js in Code Block Pro – Beautiful Syntax Highlighting 1.2.4, at postcss.config.js

53 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 const tailwind = require('./tailwind.config');
2
3 module.exports = ({ mode, file }) => ({
4 ident: 'postcss',
5 sourceMap: mode !== 'production',
6 plugins: [
7 require('postcss-import'),
8 require('tailwindcss/nesting'),
9 require('tailwindcss')({
10 ...tailwind,
11 // Scope the editor css separately from the frontend css.
12 content: file.endsWith('editor.css')
13 ? ['./src/editor/**/*.{ts,tsx}']
14 : ['./src/front/**/*.{ts,tsx}'],
15 important:
16 tailwind.important +
17 (file.endsWith('editor.css') ? '-editor' : ''),
18 }),
19 (css) =>
20 css.walkRules((rule) => {
21 // Removes top level TW styles like *::before {}
22 rule.selector.startsWith('*') && rule.remove();
23
24 // This will allow users to override something like
25 // padding within the block styles
26 if (file.endsWith('style.css')) {
27 // This appends the :not() exception to padding and margins
28 if (new RegExp('[:]?[^a-z]-?p[a-z]?-.+').test(rule)) {
29 rule.selector += ':not([style*="padding"])';
30 }
31 if (new RegExp('[:]?[^a-z]-?m[a-z]?-.+').test(rule)) {
32 rule.selector += ':not([style*="margin"])';
33 }
34 }
35 }),
36 // See: https://github.com/WordPress/gutenberg/blob/trunk/packages/postcss-plugins-preset/lib/index.js
37 require('autoprefixer')({ grid: true }),
38 !file.endsWith('editor.css') && require('postcss-safe-important'),
39 mode === 'production' &&
40 // See: https://github.com/WordPress/gutenberg/blob/trunk/packages/scripts/config/webpack.config.js#L68
41 require('cssnano')({
42 preset: [
43 'default',
44 {
45 discardComments: {
46 removeAll: true,
47 },
48 },
49 ],
50 }),
51 ],
52 });
53