Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(config-file): ✨ add feature to import package without path node_modules #144

Merged
merged 3 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 47 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,71 @@

*Just more mixins and functions with SCSS for more productive projects.*

## Getting Started
NPM
```
npm i -D sass-pire
```
`sass-pire` is a lightweight and versatile library of SCSS mixins and functions designed to simplify your development workflow. Whether you're managing styles for a large-scale project or just need handy utilities, `sass-pire` helps you write cleaner, more efficient SCSS.

---

Yarn
## Installation

### NPM
```bash
npm i -D sass-pire
```

### Yarn
```bash
yarn add sass-pire --dev
```

---

## Usage
After installing `sass-pire` using your favorite package manager, you can import it into any `SCSS` file you want and use it easily.

Example:
If you are at `index.scss` file, you can import the `sass-pire.scss` using `@import` statement:
```
@import "/path/to/root/directory/node_modules/sass-pire/src/sass-pire.scss";
```
After installing `sass-pire` using your favorite package manager, you can import it into any SCSS file.

Or by using `@use` statement:
### Recommended Approach
```scss
@use "sass-pire" as *;
```
@use "/path/to/root/directory/node_modules/sass-pire/src/sass-pire.scss" as *;

### Configure Load Path
Make sure to add the `--load-path=node_modules` flag in your `sass` command in `package.json`:
```json
"scripts": {
"watch:sass": "sass --load-path=node_modules --watch ./src/index.scss"
}
```

### Deprecation Notice
The `@import` statement will be deprecated in future versions of `Sass`. We strongly recommend using the `@use` statement instead.

---

## Features

* `Mixins` with its vendor prefixes.
* Useful `Functions` to use easily.
* `Media queries` with a sufficient amount of screens to match all of it.
- **`Reusable Mixins`**: Predefined mixins with `vendor prefixes` for cross-browser compatibility.
- **`Utility Functions`**: Handy functions to streamline calculations and style definitions.
- **`Media Queries`**: Ready-to-use breakpoints for responsive design.
- **Using [`reset-zone`](https://www.npmjs.com/package/reset-zone) for resetting styles.**
- **Add `utility classes` to your HTML elements.**

## Contribute
You can contribute to `sass-pire` by making a fork of this repository and cloning it in your local device.
---

It is very important to make a `new branch` to your `feature` or `solve a bug` or `solve an issue`.
## Contribution

## Do you want more features?
Please, set a new issue and labeled it as `Feature` and insert what you want.
Contributions are welcome! Here’s how you can help:
1. Fork the repository and clone it to your local machine.
2. Create a new branch for your feature, bug fix, or issue resolution.
3. Submit a pull request describing your changes.

---

## Feature Requests

Have an idea for a new feature? Open an issue, label it as `Feature`, and describe your suggestion. We'd love to hear your ideas!

---

## License

[MIT](https://github.com/Black-Axis/sass-pire/blob/master/LICENSE.md)
2 changes: 1 addition & 1 deletion build/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const getSettingsText = (packageJsonObject) => {
const CONFIG = {
BANNER_PATH: 'src/mixins/general/_banner.scss',
SETTINGS_PATH: 'src/abstract/_settings.scss',
MAIN_INDEX_PATH: 'src/sass-pire.scss'
MAIN_INDEX_PATH: 'index.scss',
};

module.exports = {
Expand Down
6 changes: 4 additions & 2 deletions build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const BuildLibrary = (function () {
* * It returns a string of SCSS code that contains all variables or lists
* * which are used, as library developers, to compile them in some use cases
* * in the whole library.
*
*
* @access private
*
* @returns {string} The content of the settings file.
Expand Down Expand Up @@ -227,7 +227,9 @@ const BuildLibrary = (function () {
*/
static updateVersion(filePath, newVersion) {
try {
let content = fs.readFileSync(filePath, 'utf8');
const fullPath = path.resolve(process.cwd(), filePath);

let content = fs.readFileSync(fullPath, 'utf8');

content = content.replace(
/\/\/ @version .+/,
Expand Down
10 changes: 5 additions & 5 deletions src/sass-pire.scss → index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,30 @@
// * The "abstract" module may contain abstract styles or variables used
// * throughout the project.
// @see abstract
@forward "abstract";
@forward "./src/abstract";

// * forwarding the "functions" module.
// * The "functions" module likely contains custom Sass functions for use
// * in stylesheets.
// @see functions
@forward "functions";
@forward "./src/functions";

// * forwarding the "mixins" module.
// * The "mixins" module probably contains reusable Sass mixins.
// @see mixins
@forward "mixins";
@forward "./src/mixins";

// * forwarding the "helpers" module.
// * The "helpers" module may contain helper classes or functions for
// * simplifying styles.
// @see helpers
@forward "helpers";
@forward "./src/helpers";

// * forwarding the "development-utils" module.
// * The "development-utils" module might contain utilities helpful
// * during development.
// @see development-utils
@forward "development-utils";
@forward "./src/development-utils";

// * There is a utility module for the sass-pire library
// * We need to import it to use the sass-pire library
Expand Down
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@
"sass-library",
"scss-library"
],
"files": [
"src/**/*.scss",
"index.scss",
"LICENSE.md",
"README.md"
],
"exports": {
"sass": "./index.scss",
"import": "./index.scss"
},
"style": "./index.scss",
"sass": "./index.scss",
"repository": {
"url": "https://github.com/Black-Axis/sass-pire",
"type": "git"
Expand Down