@daltontan/postcss-breakpoints

1.0.2 • Public • Published

PostCSS Breakpoints

Generate classes that activate at defined widths.

Plugin syntax:

@generate-breakpoints (<name>: <width>; ...) {
	<classes>...
}

Example

Input:

@generate-breakpoints (desktop: 1280px; tablet: 1024px) {
	.test, .foobar {
		font: bold;
		& .nest {
			border: none;
		}
	}
}

Output:

@media (min-width: 1280px) {
	.desktop-test, .desktop-foobar {
		font: bold;
		& .nest {
			border: none;
		}
	}
}
@media (min-width: 1024px) {
	.tablet-test, .tablet-foobar {
		font: bold;
		& .nest {
			border: none;
		}
	}
}
.test, .foobar {
	font: bold;
	& .nest {
		border: none;
	}
}

Usage

Install plugin.

npm i @daltontan/postcss-breakpoints

Add to you PostCSS config:

module.exports = {
	plugins: [
		require('@daltontan/postcss-breakpoints'),
	]
}

/@daltontan/postcss-breakpoints/

    Package Sidebar

    Install

    npm i @daltontan/postcss-breakpoints

    Weekly Downloads

    1

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    3.47 kB

    Total Files

    6

    Last publish

    Collaborators

    • daltontan