Skip to content

Develop #2

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 5 commits into from
Oct 20, 2019
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
13 changes: 13 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"group": "build",
"problemMatcher": []
}
]
}
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.vscode-test/**
.gitattributes
.gitignore
src/**
tests/**
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Change Log
All notable changes to the "L13 CSS Snippets" extension will be documented in this file.

## [0.14.0] - 2019-10-20

### Added
- Added complete snippet list as markdown.
- Added property "content".

## [0.13.1] - 2019-08-25

### Fixed
- Fixed link in README

## [0.13.0] - 2019-08-25
- Initial release
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

This extension contains property snippets for CSS and rule snippets for SCSS.

This extension is part of the [L13 Extension Pack](https://marketplace.visualstudio.com/items?itemName=L13RARY.l13-extension-pack).

## What's new in L13 CSS Snippets 0.14.0

- Added complete snippet list as markdown.
- Added property "content".

## Index

1. [Introduction](#Introduction)
Expand All @@ -16,7 +23,7 @@ The idea of those snippets is to create a property instantly based on some simpl

Only a few prefixes are twice, because the rules are matching different properties like `fs1` -> `flex-shrink: 1;` and `font-size: 0;`. Then you have to pick the right one.

__The following prefixes are just examples to explain the rules.__ To see the complete list, please visit https://github.com/L13/vscode-css-snippets/tree/master/snippets . If a property or pattern might be missing, please open an issue on [Github](https://github.com/L13/vscode-css-snippets/issues) and make a suggestion.
__The following prefixes are just examples to explain the rules.__ To see the complete list, please visit [SNIPPETS.md](https://github.com/L13/vscode-css-snippets/blob/master/SNIPPETS.md). If a property or pattern might be missing, please open an issue on [Github](https://github.com/L13/vscode-css-snippets/issues) and make a suggestion.

## Shortcut rules for CSS snippets

Expand Down
967 changes: 967 additions & 0 deletions SNIPPETS.md

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "l13-css-snippets",
"displayName": "L13 CSS Snippets",
"description": "Snippets for CSS and SCSS",
"version": "0.13.1",
"version": "0.14.0",
"publisher": "L13RARY",
"preview": true,
"license": "SEE LICENCE IN LICENCE.md",
Expand Down Expand Up @@ -45,5 +45,8 @@
"path": "./snippets/scss.json"
}
]
}
},
"scripts": {
"build": "node ./src/index.js"
}
}
11 changes: 11 additions & 0 deletions snippets/css.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,17 @@
"clip: rect(0, 0, 0, 0);": { "prefix": "cr4", "body": ["clip: rect(${1:0}, ${2:0}, ${3:0}, ${0:0});"], "description": "" },

"color: #000000;": { "prefix": "c_", "body": ["color: ${0:#000000};"], "description": "" },

"content: '';": { "prefix": "c", "body": ["content: '$0';"], "description": "" },
"content: attr();": { "prefix": "ca", "body": ["content: attr($0);"], "description": "" },
"content: close-quote;": { "prefix": "ccq", "body": ["content: close-quote;"], "description": "" },
"content: counter;": { "prefix": "cc", "body": ["content: counter;"], "description": "" },
"content: no-close-quote;": { "prefix": "cncq", "body": ["content: no-close-quote;"], "description": "" },
"content: no-open-quote;": { "prefix": "cnoq", "body": ["content: no-open-quote;"], "description": "" },
"content: none;": { "prefix": "cn", "body": ["content: none;"], "description": "" },
"content: normal;": { "prefix": "cn", "body": ["content: normal;"], "description": "" },
"content: open-quote;": { "prefix": "coq", "body": ["content: open-quote;"], "description": "" },
"content: url();": { "prefix": "cu", "body": ["content: url($0);"], "description": "" },

"-prefix-column-count: 0;": { "prefix": "-cc1", "body": ["-moz-column-count: ${0:0};", "-webkit-column-count: ${0:0};", "column-count: ${0:0};"], "description": "" },
"column-count: 0;": { "prefix": "cc1", "body": ["column-count: ${0:0};"], "description": "" },
Expand Down
47 changes: 47 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Imports ____________________________________________________________________

const fs = require('fs');
const path = require('path');

// Variables __________________________________________________________________

const paths = {
CSS: '../snippets/css.json',
SCSS: '../snippets/scss.json',
};

const snippets = [`## CSS and SCSS Snippets

Complete list of all CSS and SCSS snippets for Visual Studio Code. The rules for all these snippets are explained in the [README.md](./README.md)
`];

// Initialize _________________________________________________________________

for (const [headline, pathname] of Object.entries(paths)) {
const json = JSON.parse(fs.readFileSync(path.join(__dirname, pathname), 'utf-8'));
snippets.push(`### ${headline}

| Prefix | Snippet |
| ------:| ------- |
`);

for (const snippet of Object.values(json)) {
if (snippet.prefix !== '___') snippets[snippets.length - 1] += formatSnippets(snippet);
}
}

fs.writeFileSync(path.join(__dirname, '..', 'SNIPPETS.md'), snippets.join('\n'), 'utf-8');

// Exports ____________________________________________________________________



// Functions __________________________________________________________________

function formatSnippets (snippet) {

const body = snippet.body.join(' ').replace(/\t/g, '').replace(/`/g, '\`');

return `| \`${snippet.prefix}\` | \`${body}\` |\n`;

}