Skip to content

Commit df2e64d

Browse files
authored
Add a reset tool && Switch to dart-sass (#64)
1 parent eef4abc commit df2e64d

File tree

5 files changed

+386
-1277
lines changed

5 files changed

+386
-1277
lines changed

index.scss

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
11
// Helpers
2-
@import 'src/helpers/aspect-ratio';
3-
@import 'src/helpers/auto-grid';
4-
@import 'src/helpers/font-size';
5-
@import 'src/helpers/full-bleed';
6-
@import 'src/helpers/grid';
7-
@import 'src/helpers/loader';
8-
@import 'src/helpers/rainbow';
9-
@import 'src/helpers/scroll-shadow';
10-
@import 'src/helpers/select';
11-
@import 'src/helpers/text-truncate';
12-
@import 'src/helpers/triangle';
13-
@import 'src/helpers/unbreak';
2+
@import './src/helpers/aspect-ratio';
3+
@import './src/helpers/auto-grid';
4+
@import './src/helpers/bem';
5+
@import './src/helpers/font-size';
6+
@import './src/helpers/full-bleed';
7+
@import './src/helpers/grid';
8+
@import './src/helpers/loader';
9+
@import './src/helpers/rainbow';
10+
@import './src/helpers/scroll-shadow';
11+
@import './src/helpers/select';
12+
@import './src/helpers/text-truncate';
13+
@import './src/helpers/triangle';
14+
@import './src/helpers/unbreak';
1415

1516
// Tools
16-
@import 'src/tools/hover';
17-
@import 'src/tools/mq';
18-
@import 'src/tools/string-replace';
19-
@import 'src/tools/svg-background-multiple';
20-
@import 'src/tools/svg-background';
21-
@import 'src/tools/svg-url';
22-
@import 'src/tools/v';
17+
@import './src/tools/asset';
18+
@import './src/tools/half-negative-numbers';
19+
@import './src/tools/half-numbers';
20+
@import './src/tools/hover';
21+
@import './src/tools/mq';
22+
@import './src/tools/negative-number';
23+
@import './src/tools/reset';
24+
@import './src/tools/shade';
25+
@import './src/tools/spacing-helpers';
26+
@import './src/tools/string-replace';
27+
@import './src/tools/svg-background-multiple';
28+
@import './src/tools/svg-background';
29+
@import './src/tools/svg-url';
30+
@import './src/tools/tint';
31+
@import './src/tools/to-boolean';
32+
@import './src/tools/v';
33+
@import './src/tools/z-index';

package.json

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
{
22
"name": "scss-goodies",
3-
"version": "1.3.0",
3+
"version": "2.0.0",
44
"description": "SCSS tools and helpers for every day usage",
5-
"scripts": {
6-
"docs": "sassdoc src --dest docs",
7-
"build": "node-sass index.scss dist/index.css",
8-
"test": "tape test.js"
9-
},
105
"keywords": [
116
"SCSS",
127
"SCSS helpers",
@@ -15,18 +10,47 @@
1510
"SCSS goodies",
1611
"SCSS utilities"
1712
],
18-
"author": "Atanas Atanasov <scriptex.bg@gmail.com> (https://atanas.info)",
19-
"repository": "https://github.com/scriptex/scss-helpers",
13+
"homepage": "https://atanas.info/projects/scss-goodies.html",
2014
"bugs": {
2115
"url": "https://github.com/scriptex/scss-helpers/issues",
2216
"email": "scriptex.bg@gmail.com"
2317
},
2418
"license": "MIT",
19+
"scripts": {
20+
"docs": "rm -rf docs && sassdoc src --dest docs",
21+
"build": "rm -rf dist && sass index.scss dist/index.css --no-source-map",
22+
"test": "yarn build && tape test.js"
23+
},
24+
"author": {
25+
"name": "Atanas Atanasov",
26+
"email": "scriptex.bg@gmail.com",
27+
"url": "https://atanas.info"
28+
},
29+
"funding": [
30+
{
31+
"type": "individual",
32+
"url": "https://www.paypal.me/scriptex"
33+
},
34+
{
35+
"type": "patreon",
36+
"url": "https://www.patreon.com/atanas"
37+
},
38+
{
39+
"type": "individual",
40+
"url": "https://ko-fi.com/scriptex"
41+
}
42+
],
43+
"repository": "https://github.com/scriptex/scss-helpers",
2544
"main": "index.scss",
2645
"style": "index.scss",
46+
"dependencies": {
47+
"sass": "1.43.5"
48+
},
2749
"devDependencies": {
28-
"node-sass": "6.0.1",
2950
"sassdoc": "2.7.3",
30-
"tape": "5.3.1"
51+
"tape": "5.3.2"
52+
},
53+
"peerDependencies": {
54+
"sass": ">=1.43.0"
3155
}
3256
}

src/tools/_reset.scss

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/// A modern CSS reset
2+
/// @access public
3+
/// @author Atanas Atanasov <scriptex.bg@gmail.com>
4+
/// @example @include reset();
5+
/// @example @include reset($all: true, $box-sizing: true, $image: true, $table: true, $textarea: true, $contenteditable: false);
6+
/// @group tools
7+
/// @param {boolean} $all [true] - If `true`, reset all properties for all elements effectively removing all user agent styles. This does not apply to the `display` property.
8+
/// @param {boolean} $box-sizing [true] - If `true`, sets the `box-sizing` property to `border-box` on all elements.
9+
/// @param {boolean} $image [true] - If `true`, disallows images to exceed their container's width.
10+
/// @param {boolean} $table [true] - If `true`, removes the spacing between table cells.
11+
/// @param {boolean} $textarea [true] - If `true`, reverts the `white-space` property for textarea elements on Safari.
12+
/// @param {boolean} $contenteditable [true] - If `true`, fixes a bug on Chromium browsers with the `contenteditable` attribute.
13+
@mixin reset($all: true, $box-sizing: true, $image: true, $table: true, $textarea: true, $contenteditable: true) {
14+
@if $all {
15+
*:where(:not(iframe, canvas, img, svg, video):not(svg *, symbol *)) {
16+
all: unset;
17+
display: revert;
18+
}
19+
}
20+
21+
@if $box-sizing {
22+
* {
23+
box-sizing: border-box;
24+
}
25+
26+
*::before,
27+
*::after {
28+
box-sizing: inherit;
29+
}
30+
}
31+
32+
@if $image {
33+
img {
34+
max-width: 100%;
35+
}
36+
}
37+
38+
@if $table {
39+
table {
40+
border-collapse: collapse;
41+
}
42+
}
43+
44+
@if $textarea {
45+
textarea {
46+
white-space: revert;
47+
}
48+
}
49+
50+
@if $contenteditable {
51+
:where([contenteditable]) {
52+
-moz-user-modify: read-write;
53+
-webkit-user-modify: read-write;
54+
overflow-wrap: break-word;
55+
-webkit-line-break: after-white-space;
56+
}
57+
}
58+
}

test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ tape('Should build successfully', t => {
2626
tape('Should not leave footprints', t => {
2727
const build = resolve(__dirname, 'dist', 'index.css');
2828
const content = readFileSync(build, 'utf-8');
29-
t.equal(content, '', 'index.css is empty');
29+
t.equal(content.trim(), '', 'index.css is empty');
3030
t.end();
3131
});
3232

0 commit comments

Comments
 (0)