Skip to content

Logical Float and Clear #781

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

Merged
merged 8 commits into from
Jan 19, 2023
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
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/css-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ body:
- PostCSS Is Pseudo Class
- PostCSS Lab Function
- PostCSS Logical
- PostCSS Logical Float and Clear
- PostCSS Media Queries Aspect-Ratio Number Values
- PostCSS Media Query Ranges
- PostCSS Nested Calc
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/plugin-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ body:
- PostCSS Is Pseudo Class
- PostCSS Lab Function
- PostCSS Logical
- PostCSS Logical Float and Clear
- PostCSS Media Queries Aspect-Ratio Number Values
- PostCSS Media Query Ranges
- PostCSS Nested Calc
Expand Down
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@
- plugins/postcss-logical/**
- experimental/postcss-logical/**

"plugins/postcss-logical-float-and-clear":
- plugins/postcss-logical-float-and-clear/**
- experimental/postcss-logical-float-and-clear/**

"plugins/media-queries-aspect-ratio-number-values":
- plugins/postcss-media-queries-aspect-ratio-number-values/**
- experimental/postcss-media-queries-aspect-ratio-number-values/**
Expand Down
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions plugins/postcss-logical-float-and-clear/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
package-lock.json
yarn.lock
*.result.css
*.result.css.map
*.result.html
1 change: 1 addition & 0 deletions plugins/postcss-logical-float-and-clear/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.8.0
29 changes: 29 additions & 0 deletions plugins/postcss-logical-float-and-clear/.tape.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import postcssTape from '../../packages/postcss-tape/dist/index.mjs';
import plugin from '@csstools/postcss-logical-float-and-clear';

postcssTape(plugin)({
basic: {
message: "supports basic usage",
},
'basic:hebrew': {
message: "supports { inlineDirection: 'right-to-left' }",
options: {
inlineDirection: 'right-to-left'
}
},
'basic:vertical': {
message: "supports { inlineDirection: 'top-to-bottom' }",
options: {
inlineDirection: 'top-to-bottom'
}
},
'examples/example': {
message: 'minimal example',
},
'examples/example:hebrew': {
message: 'minimal example',
options: {
inlineDirection: 'right-to-left'
}
},
});
5 changes: 5 additions & 0 deletions plugins/postcss-logical-float-and-clear/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changes to PostCSS Logical Float And Clear

### 1.0.0 (Unreleased)

- Initial version
260 changes: 260 additions & 0 deletions plugins/postcss-logical-float-and-clear/INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
# Installing PostCSS Logical Float And Clear

[PostCSS Logical Float And Clear] runs in all Node environments, with special instructions for:

- [Node](#node)
- [PostCSS CLI](#postcss-cli)
- [PostCSS Load Config](#postcss-load-config)
- [Webpack](#webpack)
- [Create React App](#create-react-app)
- [Next.js](#nextjs)
- [Gulp](#gulp)
- [Grunt](#grunt)



## Node

Add [PostCSS Logical Float And Clear] to your project:

```bash
npm install postcss @csstools/postcss-logical-float-and-clear --save-dev
```

Use it as a [PostCSS] plugin:

```js
// commonjs
const postcss = require('postcss');
const postcssLogicalFloatAndClear = require('@csstools/postcss-logical-float-and-clear');

postcss([
postcssLogicalFloatAndClear(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```

```js
// esm
import postcss from 'postcss';
import postcssLogicalFloatAndClear from '@csstools/postcss-logical-float-and-clear';

postcss([
postcssLogicalFloatAndClear(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```

## PostCSS CLI

Add [PostCSS CLI] to your project:

```bash
npm install postcss-cli @csstools/postcss-logical-float-and-clear --save-dev
```

Use [PostCSS Logical Float And Clear] in your `postcss.config.js` configuration file:

```js
const postcssLogicalFloatAndClear = require('@csstools/postcss-logical-float-and-clear');

module.exports = {
plugins: [
postcssLogicalFloatAndClear(/* pluginOptions */)
]
}
```

## PostCSS Load Config

If your framework/CLI supports [`postcss-load-config`](https://github.com/postcss/postcss-load-config).

```bash
npm install @csstools/postcss-logical-float-and-clear --save-dev
```

`package.json`:

```json
{
"postcss": {
"plugins": {
"@csstools/postcss-logical-float-and-clear": {}
}
}
}
```

`.postcssrc.json`:

```json
{
"plugins": {
"@csstools/postcss-logical-float-and-clear": {}
}
}
```

_See the [README of `postcss-load-config`](https://github.com/postcss/postcss-load-config#usage) for more usage options._

## Webpack

_Webpack version 5_

Add [PostCSS Loader] to your project:

```bash
npm install postcss-loader @csstools/postcss-logical-float-and-clear --save-dev
```

Use [PostCSS Logical Float And Clear] in your Webpack configuration:

```js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
use: [
"style-loader",
{
loader: "css-loader",
options: { importLoaders: 1 },
},
{
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [
// Other plugins,
[
"@csstools/postcss-logical-float-and-clear",
{
// Options
},
],
],
},
},
},
],
},
],
},
};
```

## Create React App

Add [React App Rewired] and [React App Rewire PostCSS] to your project:

```bash
npm install react-app-rewired react-app-rewire-postcss @csstools/postcss-logical-float-and-clear --save-dev
```

Use [React App Rewire PostCSS] and [PostCSS Logical Float And Clear] in your
`config-overrides.js` file:

```js
const reactAppRewirePostcss = require('react-app-rewire-postcss');
const postcssLogicalFloatAndClear = require('@csstools/postcss-logical-float-and-clear');

module.exports = config => reactAppRewirePostcss(config, {
plugins: () => [
postcssLogicalFloatAndClear(/* pluginOptions */)
]
});
```

## Next.js

Read the instructions on how to [customize the PostCSS configuration in Next.js](https://nextjs.org/docs/advanced-features/customizing-postcss-config)

```bash
npm install @csstools/postcss-logical-float-and-clear --save-dev
```

Use [PostCSS Logical Float And Clear] in your `postcss.config.json` file:

```json
{
"plugins": [
"@csstools/postcss-logical-float-and-clear"
]
}
```

```json5
{
"plugins": [
[
"@csstools/postcss-logical-float-and-clear",
{
// Optionally add plugin options
}
]
]
}
```

## Gulp

Add [Gulp PostCSS] to your project:

```bash
npm install gulp-postcss @csstools/postcss-logical-float-and-clear --save-dev
```

Use [PostCSS Logical Float And Clear] in your Gulpfile:

```js
const postcss = require('gulp-postcss');
const postcssLogicalFloatAndClear = require('@csstools/postcss-logical-float-and-clear');

gulp.task('css', function () {
var plugins = [
postcssLogicalFloatAndClear(/* pluginOptions */)
];

return gulp.src('./src/*.css')
.pipe(postcss(plugins))
.pipe(gulp.dest('.'));
});
```

## Grunt

Add [Grunt PostCSS] to your project:

```bash
npm install grunt-postcss @csstools/postcss-logical-float-and-clear --save-dev
```

Use [PostCSS Logical Float And Clear] in your Gruntfile:

```js
const postcssLogicalFloatAndClear = require('@csstools/postcss-logical-float-and-clear');

grunt.loadNpmTasks('grunt-postcss');

grunt.initConfig({
postcss: {
options: {
processors: [
postcssLogicalFloatAndClear(/* pluginOptions */)
]
},
dist: {
src: '*.css'
}
}
});
```

[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
[PostCSS]: https://github.com/postcss/postcss
[PostCSS CLI]: https://github.com/postcss/postcss-cli
[PostCSS Loader]: https://github.com/postcss/postcss-loader
[PostCSS Logical Float And Clear]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-logical-float-and-clear
[React App Rewire PostCSS]: https://github.com/csstools/react-app-rewire-postcss
[React App Rewired]: https://github.com/timarney/react-app-rewired
[Next.js]: https://nextjs.org
Loading