Skip to content

Commit

Permalink
🩹 fix(patch): update @roots/sage/stylelint (#2607)
Browse files Browse the repository at this point in the history
Update: `@roots/sage/stylelint` config
Adds: `examples/sage-with-stylelint`

The conf change is here: https://github.com/roots/bud/compare/main...fix-2605-stylelint-error?body=&expand=1#diff-73c6bd3eb14f934c85b687f68cd04d88dbf07e9608422f988014e70fac148eb5

## Type of change

**PATCH: backwards compatible change**



@chrillep does this seem right to you?
  • Loading branch information
kellymears authored Jun 21, 2024
1 parent 15037dd commit 38e8844
Show file tree
Hide file tree
Showing 19 changed files with 173 additions and 3 deletions.
8 changes: 8 additions & 0 deletions examples/sage-with-stylelint/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/node_modules
/vendor
/public
.env
npm-debug.log
yarn-error.log
/storage/bud/**/*
theme.json
6 changes: 6 additions & 0 deletions examples/sage-with-stylelint/.stylelintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
extends: [
'@roots/sage/config/stylelint',
'@roots/bud-tailwindcss/stylelint',
],
}
17 changes: 17 additions & 0 deletions examples/sage-with-stylelint/bud.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {bud} from '@roots/bud'

bud
.entry({
app: ['@scripts/app', '@styles/app'],
editor: ['@scripts/editor', '@styles/editor'],
})
.copyDir('images')
.watch(['resources/views/*.blade.php'])
.serve(3000)
.proxy('http://example.test')

bud.wp.json
.useTailwindColors('extend')
.useTailwindFontFamily()
.useTailwindFontSize()
.useTailwindSpacing()
15 changes: 15 additions & 0 deletions examples/sage-with-stylelint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@examples/sage-with-stylelint",
"$schema": "https://bud.js.org/bud.package.json",
"private": true,
"type": "module",
"browserslist": [
"extends @roots/browserslist-config"
],
"devDependencies": {
"@roots/bud": "workspace:*",
"@roots/bud-stylelint": "workspace:*",
"@roots/bud-tailwindcss": "workspace:*",
"@roots/sage": "workspace:*"
}
}
Empty file.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions examples/sage-with-stylelint/resources/images/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions examples/sage-with-stylelint/resources/scripts/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {main} from '@scripts/components/main.js'

const init = () =>
window.requestAnimationFrame(function ready() {
return document.body ? main() : window.requestAnimationFrame(ready)
})

init()

if (import.meta.webpackHot) {
import.meta.webpackHot.accept('./components/main.js', init)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const main = () => {
document.body.classList.contains('no-js') &&
document.body.classList.remove('no-js')

document.body.classList.add(`text-xl`)
document.body.classList.add(`text-custom`)
}
17 changes: 17 additions & 0 deletions examples/sage-with-stylelint/resources/scripts/editor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import '@wordpress/edit-post'

import {registerBlockStyle, unregisterBlockStyle} from '@wordpress/blocks'
import domReady from '@wordpress/dom-ready'

domReady(() => {
unregisterBlockStyle('core/button', 'outline')

registerBlockStyle('core/button', {
name: 'outline',
label: 'Outline',
})
})

if (import.meta.webpackHot) {
import.meta.webpackHot.accept(console.error)
}
10 changes: 10 additions & 0 deletions examples/sage-with-stylelint/resources/styles/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@import 'tailwindcss/base';

@import 'common/global';

@import 'tailwindcss/components';
@import 'tailwindcss/utilities';

body {
background: url('@src/images/logo.svg?inline') no-repeat;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
body {
@apply font-sans text-custom;
}

#root {
@apply font-medium text-indigo-500 text-xl;

background: url("~@images/image.jpeg");
}
11 changes: 11 additions & 0 deletions examples/sage-with-stylelint/resources/styles/editor.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.block-editor-block-list__layout {
@apply font-sans;
}

.wp-block {
@apply max-w-screen-md;

&.editor-post-title__block .editor-post-title__input {
@apply font-sans;
}
}
20 changes: 20 additions & 0 deletions examples/sage-with-stylelint/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export default {
content: ['resources/**/*.{js,css,html}'],
theme: {
extend: {
colors: {
brand: {
gray: '#f7fafc',
},
},
fontFamily: {
sans: ['Inter', 'sans-serif'],
},
fontSize: {
xl: '1.25rem',
custom: '.625rem',
},
},
},
plugins: [],
}
12 changes: 12 additions & 0 deletions examples/sage-with-stylelint/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "@roots/bud/config/tsconfig.json",
"compilerOptions": {
"paths": {
"@src/*": ["./src/*"]
},
"types": ["@roots/bud", "@roots/bud-preset-wordpress", "@roots/bud-stylelint", "@roots/sage"]
},
"files": ["bud.config.js"],
"include": ["./src"],
"exclude": ["./dist"]
}
3 changes: 0 additions & 3 deletions sources/@roots/sage/config/stylelint.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ module.exports = {
],
rules: {
'at-rule-empty-line-before': null,
'declaration-colon-newline-after': null,
'no-descending-specificity': null,
'no-empty-source': null,
'selector-class-pattern': null,
'selector-id-pattern': null,
'string-quotes': null,
'value-list-comma-newline-after': null,
},
}
11 changes: 11 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8619,6 +8619,17 @@ __metadata:
languageName: unknown
linkType: soft

"@examples/sage-with-stylelint@workspace:examples/sage-with-stylelint":
version: 0.0.0-use.local
resolution: "@examples/sage-with-stylelint@workspace:examples/sage-with-stylelint"
dependencies:
"@roots/bud": "workspace:*"
"@roots/bud-stylelint": "workspace:*"
"@roots/bud-tailwindcss": "workspace:*"
"@roots/sage": "workspace:*"
languageName: unknown
linkType: soft

"@examples/sage@workspace:examples/sage":
version: 0.0.0-use.local
resolution: "@examples/sage@workspace:examples/sage"
Expand Down

0 comments on commit 38e8844

Please sign in to comment.