Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@jsslang/jss
Advanced tools
Jss is a preprocessor for Css that allows to mix css and javascript grammar. Jss generates plain Css.
CSS is a greate language for declaring styles but it lucks features of programmar language like variables, inheritance, functions and etc. With Css alone you have to reapet yourself defining complex rules. There were attempts to solve this such as LESS, SASS and etc, but they still are not a programmer langauge and another drownback of them that they use unfamiliar syntax.
With Jss you can do everything that you can with LESS or SASS and even more. You don't need to learn a complete new language. JSS is based on CSS and JavaScript the langueages you already know (JavaScript is familiar for all frontend developers) so the learning curve should be less.
npm install -g @jsslang/jss
npx @jsslang/jss file.jss file.css
or if you installed it globally
jss file.jss file.css
type jss in the console to see all available options.
You can use the javascript syntax for variables
const color = '#fff';
const baseSize = 10;
.className {
color: ${color};
size: ${baseSize + 2}px;
}
Output:
.className {
color: #fff;
size: 12px;
}
You can use buildin classes for sizes and colors. For examples:
const size = new Px(10);
const color = new HexColor('#fff');
.className {
color: ${color};
size: ${size};
}
Output:
.className {
color: #fff;
size: 10px;
}
You can put variables into style blocks. They'll be scoped inside the block.
.className {
const size = new Px(10);
color: #fff;
size: ${size};
}
Output:
.className {
color: #fff;
size: 10px;
}
You can use variables in property names
const propName = 'color';
.className {
${propName}: #fff;
background-${propName}: #777;
}
Output:
.className {
color: #fff;
background-color: #777;
}
You can even use computed properties like in javascript
const propName = 'color';
.className {
[propName]: #fff;
['background-' + propName]: #777;
}
Output:
.className {
color: #fff;
background-color: #777;
}
const bordered = @block {
border: 3px solid red;
border-radius: 3px;
};
.className {
font-size: 12px;
...bordered;
}
Output:
.className {
font-size: 12px;
border: 3px solid red;
border-radius: 3px;
}
function pad2(n) { return n.length > 1 ? n : "0" + n; }
function rgb(r,g,b) { return "#" + pad2(r.toString(16)) + pad2(g.toString(16)) + pad2(b.toString(16)); }
.className {
background: ${rgb(123,123,123)};
}
Output:
.className {
background: #7b7b7b;
}
.menu {
font-size: 12px;
${this.name}.menu__item {
color: 10px;
font-size: ${this.parent.styles.fontSize};
}
}
Output:
.menu {
font-size: 12px;
}
.menu.menu__item {
color: 10px;
font-size: 12px;
}
or in case of a list of selectors
.menu1, .menu2 {
font-size: 12px;
${this.selectors[0]}.menu__item {
color: 10px;
}
${this.selectors[1]}.menu__item {
color: 12px;
}
}
Output:
.menu1, .menu2 {
font-size: 12px;
}
.menu1.menu__item {
color: 10px;
}
.menu2.menu__item {
color: 12px;
}
You can put media-quries inside blocks
.component {
width: 300px;
@media (min-width: 768px) {
width: 600px;
@media (min-resolution: 192dpi) {
background-image: url(/img/retina2x.png);
}
}
@media (min-width: 1280px) {
width: 800px;
}
}
Output
.component {
width: 300px;
}
@media (min-width: 768px) {
.component {
width: 600px;
}
@media (min-resolution: 192dpi) {
.component {
background-image: url(/img/retina2x.png);
}
}
}
@media (min-width: 1280px) {
.component {
width: 800px;
}
}
You can use @supports in the same way.
.flex-container {
display: block;
@supports(display: flex) {
display: flex;
}
}
Output:
.flex-container {
display: block;
}
@supports (display: flex) {
.flex-container {
display: flex;
}
}
All kind of comments a supported
// a single line comment
/* a multi-line comment */
<!-- a html style comment -->
Syntax highlighting is in progress, but you can use same of our basic configs for the following text editors.
https://github.com/codeninja-ru/vim-jsslang
https://github.com/codeninja-ru/jsslang-mode
https://github.com/codeninja-ru/vscode-jsslang
FAQs
css pre-processor
We found that @jsslang/jss 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.