Skip to content

Commit 52ef292

Browse files
[CCC-50] No Build (#266)
This PR fixes some issues in the documentation and removes all references to SASS or SCSS. It is the last step to completely removing SCSS. It also updates the build step to work with the updated process.
1 parent bbb6c36 commit 52ef292

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+496
-446
lines changed

.github/workflows/linting.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ jobs:
3030
run: yarn prettier-check
3131
- name: Build CSS
3232
run: yarn build:css
33-
- name: Build SCSS
34-
run: yarn build:scss
3533
- name: Build Tokens
3634
run: yarn build:tokens
3735
- name: Build Storybook

.storybook/manager-head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<style lang="sass">
1+
<style lang="css">
22
button[data-action='collapse-root'] {
33
color: hsl(273, 22%, 18%);
44
text-transform: capitalize;
Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
@import './src/optics';
1+
@import '../src/optics';
22

3-
@import './src/recipes/domains-sidebar';
4-
@import './src/recipes/16six-sidebar';
5-
@import './src/recipes/aligned-header';
3+
@import '../src/recipes/domains-sidebar';
4+
@import '../src/recipes/16six-sidebar';
5+
@import '../src/recipes/aligned-header';
66

77
@import 'https://fonts.googleapis.com/css2?family=Tilt+Neon&display=swap';
88

@@ -59,12 +59,12 @@
5959
height: 0;
6060
}
6161

62-
// Allow the "Show Code" button to appear above the footer in examples.
62+
/* Allow the "Show Code" button to appear above the footer in examples. */
6363
.docs-story div:last-child {
6464
z-index: 1;
6565
}
6666

67-
// Transition Demos
67+
/* Transition Demos */
6868
.transition-demo {
6969
display: inline-block;
7070
padding: var(--op-space-medium);
@@ -165,7 +165,11 @@
165165
}
166166
}
167167

168-
// Prevent our tag component from interfering with the docs
168+
.text-alignment-demo {
169+
width: 400px;
170+
}
171+
172+
/* Prevent our tag component from interfering with the docs */
169173
.language-html {
170174
.tag {
171175
display: initial;
@@ -178,7 +182,7 @@
178182
}
179183
}
180184

181-
// Company Card
185+
/* Company Card */
182186
.card.card--company {
183187
display: flex;
184188
align-items: center;
@@ -192,15 +196,15 @@
192196
gap: var(--op-space-x-large);
193197

194198
.card__info-logo {
195-
width: calc(var(--op-size-unit) * 24); // 96px
199+
width: calc(var(--op-size-unit) * 24); /* 96px */
196200
}
197201

198202
p {
199203
margin: 0;
200204
}
201205
}
202206

203-
// --op-breakpoint-small
207+
/* --op-breakpoint-small */
204208
@media (width <= 768px) {
205209
flex-direction: column;
206210

.storybook/preview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const preview = {
3535
},
3636
}
3737

38-
import './preview.scss'
38+
import './preview.css'
3939

4040
export default preview
4141

.stylelintrc.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"extends": ["stylelint-config-standard-scss", "stylelint-config-idiomatic-order", "stylelint-config-prettier-scss"],
3-
"plugins": ["stylelint-scss", "stylelint-prettier"],
4-
"overrides": [
5-
{
6-
"files": ["**/*.scss"],
7-
"customSyntax": "postcss-scss"
8-
}
9-
],
2+
"extends": ["stylelint-config-idiomatic-order"],
3+
"plugins": ["stylelint-prettier"],
4+
"overrides": [],
105
"rules": {
116
"prettier/prettier": true,
12-
"custom-property-pattern": ["(?<=op-)", { "message": "CSS variables should be prefixed with op-" }],
7+
"custom-property-pattern": [
8+
"(?<=op-)",
9+
{
10+
"message": "CSS variables should be prefixed with op-"
11+
}
12+
],
1313
"selector-class-pattern": null
1414
}
1515
}

NEW_COMPONENT.md

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,44 @@
22

33
To create a new CSS component, follow these steps:
44

5-
1. Start by defining a Sass `%{component-name}-global` placeholder for the component. This placeholder will serve as the base style for the component and all its variants.
6-
2. Extend the default class and all variants of the component with the global placeholder you defined in the previous step. This ensures that the base style is applied consistently across all variations.
7-
3. When creating variants of the component, use the following syntax: `.{component-name}-{variant}`. Variants are top-level components that have distinct styles or functionalities.
8-
4. For stylistic tweaks that apply to all variants, use modifiers following the BEM (Block, Element, Modifier) syntax. The modifier class should be in the format: `.{component-name}--{modifier}`.
9-
10-
<!-- TODO: This distintion should exist in the main docs as well, not just in the dev instructions. Understanding how to consume components in your app and know the distinctions here is a good idea. -->
11-
12-
## Variant vs. Modifier
13-
14-
A variant is a top-level component that has distinct styles or functionalities. For example, a button component can have a primary variant that has a different color and hover state than the default button. A modifier is a class that modifies the style of a component. For example, a button component can have a disabled modifier that changes the color and cursor of the button. Modifiers apply to all Variants.
5+
1. Start by defining a css `.{component-name}` selector for the component. This will serve as the base style for the component and all its variants.
6+
2. Create modifiers for any all variants of the component you defined in the previous step. This ensures that the base style is shared consistently across all variations.
7+
3. When creating variants of the component, use the following syntax: `.{component-name}--{variant}`. It can be helpful to nest these under the main class with a `&.{component-name}--{variant}` to ensure they only work with that component.
8+
4. For stylistic tweaks that apply to all variants, use modifiers following the BEM (Block, Element, Modifier) syntax. The modifier class should be in the format: `.{component-name}--{modifier}` just like the other variants.
159

1610
To illustrate these concepts, let's consider an example of a button. You can use the following template as a guide:
1711

18-
```scss
19-
// Define the global placeholder for the button component
20-
%button-global {
21-
// Base styles for the button
12+
```css
13+
/* Define the main component */
14+
.btn {
15+
/* Base styles for the button */
2216

23-
// Hover state
17+
/* Hover state */
2418
&:hover {
25-
// Styles for the hovered button modifier
26-
// ...
19+
/*
20+
Styles for the hovered button modifier
21+
...
22+
*/
2723
}
2824

29-
// Modifier: Large button
25+
/* Modifier: Large button */
3026
&.btn--large {
31-
// Styles for the large button modifier
27+
/* Styles for the large button modifier */
3228
}
3329

34-
// Modifier: Disabled button
30+
/* Modifier: Disabled button */
3531
&.btn--disabled,
3632
&:disabled {
37-
// Styles for the disabled button modifier
33+
/* Styles for the disabled button modifier */
3834
}
3935
}
4036

41-
// Default button class extending the global styles
42-
.btn {
43-
@extend %button-global;
44-
// Specific styles for the default button variant
45-
// ...
46-
}
47-
48-
// Variant: Primary button
49-
.btn-primary {
50-
@extend %button-global;
51-
// Specific styles for the primary button variant
52-
// ...
37+
/* Variant: Primary button */
38+
.btn.btn--primary {
39+
/*
40+
Specific styles for the primary button variant
41+
...
42+
*/
5343
}
5444
```
5545

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
</div>
1414

15-
Optics is an scss package that provides base styles and components that can be integrated and customized in a variety of projects.
15+
Optics is an css package that provides base styles and components that can be integrated and customized in a variety of projects.
1616

1717
## Installation
1818

@@ -30,16 +30,14 @@ yarn add @rolemodel/optics
3030

3131
### Import
3232

33-
If you are using webpack to compile, you can add this import to the top of your root level `scss` file.
33+
You can add this import to the top of your root level `css` file.
3434

35-
```scss
36-
@import '@rolemodel/optics';
37-
```
38-
39-
If you are using a different compiler such as Dart Sass, you may need to reference the scss file directly.
40-
41-
```scss
42-
@import '@rolemodel/optics/dist/scss/optics';
35+
```css
36+
@import '@rolemodel/optics'; /* Using webpack to compile */
37+
/* Or */
38+
@import '@rolemodel/optics/dist/css/optics'; /* Using a different compiler or no compiler */
39+
/* Or */
40+
@import '@rolemodel/optics/dist/css/optics.min.css'; /* If you want a single file with all the styles in it. */
4341
```
4442

4543
## Documentation
@@ -65,7 +63,7 @@ Add the following above a group to categorize the tokens.
6563

6664
### Component Documentation
6765

68-
For instructions on how to create a new component, see [Process for Creating New Components](./NEW_COMPONENT.MD)
66+
For instructions on how to create a new component, see [Process for Creating New Components](./NEW_COMPONENT.md)
6967

7068
Additional stories can be added using the following command, or copying an existing story.
7169

build_token_json.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,7 @@ try {
128128
fs.readdir(source, { withFileTypes: true }, (_errors, files) => {
129129
let variables = {}
130130
files
131-
.filter(
132-
(directoryEntry) =>
133-
directoryEntry.isFile() &&
134-
directoryEntry.name !== 'dark_mode_tokens.scss' &&
135-
directoryEntry.name !== 'index.scss'
136-
)
131+
.filter((directoryEntry) => directoryEntry.isFile() && directoryEntry.name !== 'index.css')
137132
.forEach((directoryEntry) => {
138133
const fileContents = fs.readFileSync(`${source}/${directoryEntry.name}`)
139134
const matches = fileContents.toString().match(/^\s*--.*?(?=;)/gm)

optics-design-system.code-workspace

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"settings": {
88
"prettier.configPath": ".prettierrc.json",
99
"stylelint.configFile": ".stylelintrc.json",
10-
"stylelint.validate": ["css", "scss"],
10+
"stylelint.validate": ["css"],
1111
"editor.codeActionsOnSave": {
1212
"source.fixAll.stylelint": "always",
1313
},

package.json

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
22
"name": "@rolemodel/optics",
3-
"version": "1.12.0",
3+
"version": "2.0.0",
44
"packageManager": "yarn@4.2.2",
5-
"description": "Optics is an scss package that provides base styles and components that can be integrated and customized in a variety of projects.",
6-
"main": "dist/scss/optics.scss",
5+
"description": "Optics is a css package that provides base styles and components that can be integrated and customized in a variety of projects.",
6+
"main": "dist/css/optics.css",
77
"scripts": {
88
"test": "exit 0",
9-
"build": "yarn build:css && yarn build:scss && yarn build:tokens",
10-
"build:css": "sass src/optics.scss dist/css/optics.css --load-path=node_modules/",
11-
"build:scss": "rsync -a src/ dist/scss --exclude stories",
9+
"build": "yarn build:css && yarn build:css-min && yarn build:tokens",
10+
"build:css": "mkdir -p dist/css; rsync -a src/ dist/css --exclude stories",
11+
"build:css-min": "postcss src/optics.css -o dist/css/optics.min.css",
1212
"build:tokens": "node build_token_json --source=src/core/tokens --output=dist/tokens/tokens.json",
1313
"storybook": "storybook dev -p 6006 --docs",
1414
"build-storybook": "storybook build --docs",
1515
"lint": "yarn lint:js && yarn lint:css",
1616
"lint-fix": "yarn lint:js --fix && yarn lint:css --fix",
1717
"lint:js": "eslint 'src/stories/**/*.js'",
18-
"lint:css": "stylelint 'src/**/*.(scss|css)'",
18+
"lint:css": "stylelint 'src/**/*.css'",
1919
"prettier": "prettier -w .",
2020
"prettier-check": "prettier -c .",
2121
"sanity-check": "yarn lint && yarn prettier && yarn build && yarn build-storybook && rm -rf ./dist && rm -rf ./storybook-static",
@@ -30,7 +30,6 @@
3030
"CSS",
3131
"System",
3232
"RoleModel",
33-
"SCSS",
3433
"Optics"
3534
],
3635
"author": "RoleModel Software",
@@ -64,19 +63,15 @@
6463
"eslint-plugin-storybook": "^0.6.13",
6564
"generate-template-files": "^3.2.1",
6665
"postcss": "^8.4.38",
67-
"postcss-scss": "^4.0.9",
66+
"postcss-cli": "^11.0.0",
67+
"postcss-import": "^16.1.0",
6868
"prettier": "^3.0.0",
69-
"sass": "^1.77.2",
70-
"sass-loader": "^14.1.0",
7169
"storybook": "^8.1.3",
7270
"storybook-design-token": "^3.1.0",
7371
"style-loader": "^3.3.3",
7472
"stylelint": "^16.2.1",
7573
"stylelint-config-idiomatic-order": "^10.0.0",
76-
"stylelint-config-prettier-scss": "^1.0.0",
77-
"stylelint-config-standard-scss": "^13.0.0",
7874
"stylelint-prettier": "^5.0.0",
79-
"stylelint-scss": "^6.1.0",
8075
"vite": "^5.2.11"
8176
},
8277
"peerDependencies": {

0 commit comments

Comments
 (0)