
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Makes CSS Grid code readable by giving it a visual syntax.
100% native Javascript, no dependencies.
npm install --save jss-grid
yarn add jss-grid
Import the grid() function.
Spread ... the return value of grid() in the desired JSS class.
Sketch your grid in a `template literal` string.
| | (pipe) delimiters-- (dash) delimiters.{ } (curly braces).`` , normal strings aren't multiline.import grid from 'jss-grid'
const styles = {
className: {
background: '#eee',
...grid(
`
{1em, 2em} | 1fr | 8fr | 1fr |
--
15fr
--
1fr
--
`
)
}
}
NOTE: You can add any # of columns/rows (of the same size) by adding n followed by a factor inside a column or row definition.
grid() returns an object, therefore you must spread the result of the function call in your JSS.
( sketch ) => gridProperties
( template literal string ) => object
Takes sketch `template literal` and returns object of CSS/JSS grid properties.
Do not call grid() with (multiple) normal strings.
`
{row gap, column gap} | column | column | column | column |
--
row
--
row
--
`
Whitespace and line breaks don't matter.
But each group of definitions (gaps, columns and rows) must begin and end with their respective delimiters. In other words, don't forget to place |, --, { and } and their correct positions.
Example.
This template string literal
`
{1em, 2em} | 1fr | 8fr | 1fr |
--
15fr
--
1fr
--
`
creates these JSS properties
'grid-template-columns': '1fr 8fr 1fr',
'grid-template-rows': '15fr 1fr',
'grid-row-gap': '1em',
'grid-column-gap': '2em',
You can add multiple columns/rows of the same size by adding n followed by a integer factor inside a column or row definition.
1em n 8 will add 8 columns/rows of 1em.
The proper order of columns/rows before and after multiplication is maintained.
The following example
`
{5%} | 1fr | 2fr n 11 |
--
1fr n 10
--
2fr
--
`
produces
'grid-template-columns': '1fr 2fr 2fr 2fr 2fr 2fr 2fr 2fr 2fr 2fr 2fr 2fr',
'grid-template-rows': '1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 2fr',
'grid-gap': '5%',
{ grid gap }
{ row gap, column gap }
{ row gap, } { , column gap }
One value defines gap for BOTH rows and column.
Two comma-separated values define DIFFERENT gaps.
One value WITH comma defines row gap OR column gap.
| column |
| column n factor |
Can be any valid CSS/JSS value.
Factor has to be an integer.
--
row
--
--
row n factor
--
Can be any valid CSS/JSS value.
Factor has to be an integer.
FAQs
Define CSS Grids using visual syntax.
We found that jss-grid demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.