Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

Commit 902ed52

Browse files
Merge branch 'develop'
2 parents 8373faa + 97ea246 commit 902ed52

44 files changed

Lines changed: 1450 additions & 86 deletions

Some content is hidden

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

.editorconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ root = true
44
end_of_line = lf
55
insert_final_newline = true
66

7-
[*.{js,json,yml}]
7+
[*.{js,json,yml,scss,sass}]
88
charset = utf-8
99
indent_style = tab
1010
indent_size = 4
11+
max_line_length = 80

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ node_modules/
2626
# parcel-bundler cache (https://parceljs.org/)
2727
.cache
2828

29-
# tests directory
30-
test
29+
# tests build directory
30+
build
31+
32+
# Jest coverage
33+
coverage
3134

3235
# Yarn files
3336
.yarn/install-state.gz

.idea/esbuild-sass-modules-plugin.iml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/watcherTasks.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CODE_OF_CONDUCT.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at
59+
[officialsquirrelnetwork@gmail.com](mailto:officialsquirrelnetwork@gmail.com). All
60+
complaints will be reviewed and investigated and will result in a response that
61+
is deemed necessary and appropriate to the circumstances. The project team is
62+
obligated to maintain confidentiality with regard to the reporter of an incident.
63+
Further details of specific enforcement policies may be posted separately.
64+
65+
Project maintainers who do not follow or enforce the Code of Conduct in good
66+
faith may face temporary or permanent repercussions as determined by other
67+
members of the project's leadership.
68+
69+
## Attribution
70+
71+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
72+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
73+
74+
[homepage]: https://www.contributor-covenant.org
75+
76+
For answers to common questions about this code of conduct, see
77+
https://www.contributor-covenant.org/faq
78+
79+
<p align=center>
80+
![Squirrel Network](https://avatars.githubusercontent.com/u/61167371?s=200&v=4)
81+
</p>

CONTRIBUTING.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Contributing to esbuild-sass-modules-plugin
2+
3+
The following is a set of guidelines for contributing to the project.
4+
These are mostly guidelines, not rules.
5+
Use your best judgment, and feel free to propose changes to this document in a
6+
pull request.
7+
8+
#### Table Of Contents
9+
[Code of Conduct](#code-of-conduct)
10+
11+
[tldr; I just have a question!](#tldr-i-just-have-a-question)
12+
13+
[What should I know before I get started?](#what-should-i-know-before-i-get-started)
14+
* [Package manager](#package-manager)
15+
* [Dependencies](#dependencies)
16+
* [Workflow](#workflow)
17+
* [Code style](#code-style)
18+
* [Pull requests](#pull-requests)
19+
20+
[Thank you!](#thank-you)
21+
22+
## Code of Conduct
23+
24+
This project and everyone participating in it is governed by the
25+
[Code of Conduct](CODE_OF_CONDUCT.md).
26+
By participating, you are expected to uphold this code.
27+
Please report unacceptable behavior to [officialsquirrelnetwork@gmail.com](mailto:officialsquirrelnetwork@gmail.com).
28+
29+
## TLDR; I just have a question!
30+
> **Note:** Please don't file an issue to ask a question.
31+
32+
Feel free to contact us in the network by reaching the Squirrel Network's
33+
administrators.
34+
35+
## What should I know before I get started?
36+
37+
### Package manager
38+
39+
This project uses the Yarn package manager version 3.2.1 in the _stable_ branch.
40+
To ensure version changes will not affect the build or the tests, the actual
41+
CLI is included in this repository under [.yarn/releases](.yarn/releases).
42+
43+
Beacuse of Yarn, this npm module package needs to be loaded accordingly when
44+
running tests; the following command should allow you to make both Node and Jest
45+
work with modules:
46+
47+
```shell
48+
$ yarn node --experimental-vm-modules $(yarn bin jest)
49+
```
50+
51+
### Dependencies
52+
53+
This project depends on the following packages:
54+
55+
* lodash
56+
* esbuild
57+
* jest
58+
* postcss
59+
* sass
60+
61+
However, removing or adding dependencies can be done after approved pull
62+
requests.
63+
64+
### Workflow
65+
66+
This repository is organized in the following branches:
67+
68+
* `master`: production-ready code expected to be published on npm
69+
* `develop`: working tested code that merges the features and eventually gets
70+
hotfixes
71+
* `feature/`: the branches under this name represent the features of this
72+
package and should be named accordingly
73+
* `testing`: for developing and fixing the test suites themselves
74+
75+
The usual workflow is as defined below:
76+
77+
1. Clone this repo
78+
2. Checkout `develop`
79+
3. Create or checkout the `feature/` branch you'll be working on
80+
4. Develop the feature or the tests
81+
5. Commit to that `feature/` branch only the changes in `src/`
82+
6. Move to `testing`
83+
7. Merge your `feature/` into `testing`
84+
8. Commit the changes to your test suites
85+
9. If everything goes well, checkout `feature/` again and merge `testing` to
86+
your `feature/`
87+
10. Merge `feature/` into `develop`
88+
89+
> Note: please make sure that all the branches you're working on are up-to-date,
90+
> and do not directly merge on `master`.
91+
92+
### Code style
93+
94+
> Note: please use UTF-8 without BOM for all the files and Unix-style line
95+
> endings.
96+
97+
There is not relly any defined code style, but there are some rules I would
98+
prefer the contributors to follow:
99+
100+
- Use the same indentation characters, which in this case is tabs.
101+
- The block notation I use is inspired by [Elm](https://elm-lang.org/examples/cards)
102+
and looks like these examples:
103+
```js
104+
{ property1: value
105+
, property2: value
106+
, property3: value
107+
}
108+
109+
[ item1
110+
, item2
111+
, item3
112+
]
113+
```
114+
In my opinion, this style looks more clean and easy to read and edit.
115+
- Use the `_().method` versions with lodash.
116+
- Use [BSD-style switches](https://www.freebsd.org/cgi/man.cgi?query=style&sektion=9)
117+
and scope the cases with brackets:
118+
```js
119+
switch(on) {
120+
case match: {
121+
break;
122+
}
123+
}
124+
```
125+
In my opinion, this makes it more clear where the cases begin or end, and also
126+
scopes them in a block which can sometimes be useful.
127+
- Do not go over 80 columns. I usually have multiple files open at one time, and
128+
80 columns makes it so that code can fit into my view without having to scroll
129+
it horizontally.
130+
131+
### Pull requests
132+
133+
In general, feel free to file us pull requests. There aren't any special
134+
requirements to meet I can think of, but just following this guide and the Code
135+
of Conduct should be enough.
136+
137+
## Thank you!
138+
139+
Thank you from me and the whole Squirrel Network for contributing to this small
140+
plugin!
141+
142+
<p align=center>
143+
![Squirrel Network](https://avatars.githubusercontent.com/u/61167371?s=200&v=4)
144+
</p>

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,34 @@
11
# esbuild-sass-modules-plugin
22
A sass module loader plugin for esbuild.
33

4-
This plugin allows .scss and .sass files to be imported from javascript files.
4+
![npm package version](https://img.shields.io/static/v1?label=%40squirrelnetwork%2Fesbuild-sass-modules-plugin&message=unpublished+yet&color=5AA9E6&logo=npm&logoColor=FF6392)
5+
6+
This plugin allows .scss and .sass files to be imported as modules in javascript
7+
files.
8+
9+
## Basic usge:
10+
11+
```js
12+
import esb from 'esbuild';
13+
import sassModules from '@squirrelnetwork/esbuild-sass-modules-plugin';
14+
15+
await esb.build(
16+
{ bundle: true
17+
, sourceRoot: 'src/'
18+
, entryPoints: [ 'src/index.js' ]
19+
, outfile: 'build/app.js'
20+
, plugins: [ sassModules() ]
21+
}
22+
);
23+
```
24+
25+
## Documentation
26+
27+
See the [wiki](https://github.com/Squirrel-Network/esbuild-sass-modules-plugin/wiki/)
28+
of this project.
29+
30+
[^1]: dart-sass fails to compile in tests; see [dart-sass#1692](https://github.com/sass/dart-sass/issues/1692)
31+
32+
<p align=center>
33+
![Squirrel Network](https://avatars.githubusercontent.com/u/61167371?s=200&v=4)
34+
</p>

TODO

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
- [ ] Inline resolver
2-
- [ ] URL resolver
3-
- [ ] Bundle resolver
4-
- [ ] PostCSS
5-
- [ ] Autoprefix
6-
- [ ] Configurable minify, SCSS compile options, PostCSS, ecc.
7-
- [ ] Add tests
1+
- [x] Import statement
2+
- [x] Inline resolver
3+
- [x] File resolver
4+
- [x] PostCSS
5+
- [x] Configurable minify, SCSS compile options, PostCSS, ecc.
6+
- [x] Write tests
7+
- [x] Dynamic imports
8+
- [x] Write documentation
9+
- [x] 100% Coverage before 1.0.0
10+
- [x] Project cleanup

0 commit comments

Comments
 (0)