3.32.1 • Published 4 days ago

swiftcss v3.32.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 days ago

SwiftCSS

SwiftCSS is a CSS utility package that simplifies and streamlines the styling of your web projects using predefined classes. Similar to Tailwind CSS, it offers a wide range of predefined classes that allow you to style your web elements effortlessly. Additionally, SwiftCSS supports dynamic classes and pseudo-classes, making it a powerful tool for creating modern web interfaces.

Dynamic Attributes

SwiftCSS provides dynamic classes that can be customized using square brackets, allowing you to apply dynamic values to your styles. Some of the available dynamic attributes include:

color-#xxx: Customize colors dynamically. bg-#xxx: Set dynamic background colors. text-#xxx: Adjust text colors dynamically. And more!

Parent and Element Selectors

Parent selectors can be written by utilising a parenthesis, followed by the requirement

Example 1: (.group:hover):color-#131313

Example 2: (&.confirmed):color-green

Example 3:

(.confirmed:hover_>):cursor-pointer

Input File Integration

Unlike many other CSS frameworks, SwiftCSS offers a straightforward solution for incorporating input files. Input files are appended on top of the output file generated by the CLI, making it easy to manage and include custom styles and configurations.

Commands

SwiftCSS offers three essential commands to streamline your development workflow:

1. init

The init command generates a swiftcss.config.js file, allowing you to configure and specify various aspects of your project, including:

Input and output files. Media queries and their ranges. Directories to scan for style changes. File extensions to include.

npx swiftcss init

2. watch

The watch command monitors files across all specified directories and automatically updates the output file when changes occur. This ensures that your styles are always up to date during development.

npx swiftcss watch

3. build

The build command generates a compressed output using the PostCSS compiler, reducing the size of the output CSS file for production use.

npx swiftcss build

CSS Optimization

SwiftCSS takes care of optimizing your CSS by ensuring that only classes that have been used are included in the output. It also removes duplicates, ensuring that the final stylesheet consists of unique classes only.

Dark and Light Mode Support

SwiftCSS offers built-in support for attributes like style-light and style-dark, allowing you to specify classes and styles for dark and light mode, making it easy to create responsive and visually appealing designs.

Media Query Support

With SwiftCSS, defining responsive styles is a breeze. Simply specify your desired screen sizes and their respective ranges in the configuration file, and SwiftCSS will automatically generate classes that apply only when the screen size falls within the specified limits.

Configuration Example

Here's an example of the configuration file (swiftcss.config.js):

module.exports = {
    fileExtensions: ["html", "js", "jsx", "ts", "tsx"],
    directories: ["./src"],
    input: [""], // Specify an input file (or multiple) to be appended into the output file
    output: "./output.css",
    screens: {
        sd: { max: 600 },
        md: { min: 600, max: 1200 },
        ld: { min: 1200 },
    },
};

With the example config displayed above, the compiler will accept the following labels: style-sd, style-md & style-ld. Would you add for instance xl:

module.exports = {
    fileExtensions: ["html", "js", "jsx", "ts", "tsx"],
    directories: ["./src"],
    input: "", // Specify an input file to be appended into the output file
    output: "./output.css",
    screens: {
        sd: { max: 600 },
        md: { min: 600, max: 1200 },
        ld: { min: 1200, max: 1800 },
        xl: { min: 1800 }
    },
};

Then style-xl will be accepted.

This configuration allows you to customize SwiftCSS to suit your project's specific needs by specifying input files, output file paths, supported screen sizes, and more.

Get started with SwiftCSS and simplify your web styling today! For detailed usage instructions, please refer to the official documentation.

3.32.1

4 days ago

3.32.0

17 days ago

3.31.0

2 months ago

3.30.0

3 months ago

3.29.0

4 months ago

3.28.0

5 months ago

3.27.0

5 months ago

3.26.0

5 months ago

3.22.0

5 months ago

3.24.0

5 months ago

3.21.0

5 months ago

3.23.0

5 months ago

3.25.0

5 months ago

3.20.0

6 months ago

3.15.0

6 months ago

3.14.0

6 months ago

3.17.0

6 months ago

3.16.0

6 months ago

3.19.0

6 months ago

3.18.0

6 months ago

3.11.0

7 months ago

3.10.0

7 months ago

3.13.0

7 months ago

3.12.0

7 months ago

2.5.0

7 months ago

2.4.0

7 months ago

3.9.0

7 months ago

3.4.0

7 months ago

3.3.0

7 months ago

3.2.0

7 months ago

3.1.0

7 months ago

3.8.0

7 months ago

3.6.0

7 months ago

3.5.0

7 months ago

3.0.0

7 months ago

2.3.0

8 months ago

2.2.0

8 months ago

2.1.0

8 months ago

2.0.0

8 months ago

1.13.0

8 months ago

1.12.0

8 months ago

1.11.0

8 months ago

1.10.0

8 months ago

1.9.0

8 months ago

1.8.0

8 months ago

1.7.0

8 months ago

1.6.0

8 months ago

1.5.0

8 months ago

1.4.0

8 months ago

1.3.0

8 months ago

1.2.7

12 months ago

1.1.6

12 months ago

1.1.5

12 months ago

1.1.4

12 months ago

1.1.3

12 months ago

1.1.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago