Skip to content

Commit

Permalink
feat: activate prettier for scss (#1468)
Browse files Browse the repository at this point in the history
  • Loading branch information
JosefBredereck authored Jan 8, 2023
1 parent f95f4f9 commit fac6ad4
Show file tree
Hide file tree
Showing 104 changed files with 1,778 additions and 1,797 deletions.
5 changes: 3 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ packages/core/scripts/api.handlebars
packages/core/scripts/events.handlebars
packages/core/test/files/annotations.js
packages/**/annotations.js
**/uikit-workshop/src/js/**/*
*.json
*.md
*.scss
**/reset.scss
**/_meta/_head.*
**/_meta/_foot.*
**/development-edition*/source/_patterns/**
160 changes: 80 additions & 80 deletions packages/docs/.eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,84 +16,84 @@ const parseTransform = require('./src/transforms/parse-transform.js');
const site = require('./src/_data/site.json');

module.exports = function (config) {
// Filters
config.addFilter('dateFilter', dateFilter);
config.addFilter('markdownFilter', markdownFilter);
config.addFilter('w3DateFilter', w3DateFilter);

// Layout aliases
config.addLayoutAlias('home', 'layouts/home.njk');

// Transforms
config.addTransform('htmlmin', htmlMinTransform);
config.addTransform('parse', parseTransform);

// Passthrough copy
config.addPassthroughCopy('src/images');
config.addPassthroughCopy('src/js');
config.addPassthroughCopy('src/admin/config.yml');
config.addPassthroughCopy('src/admin/previews.js');
config.addPassthroughCopy({
'../../node_modules/nunjucks/browser/nunjucks-slim.js':
'node_modules/nunjucks/browser/nunjucks-slim.js',
});

const now = new Date();

// Custom collections
const livePosts = (post) => post.date <= now && !post.data.draft;
config.addCollection('posts', (collection) => {
return [
...collection.getFilteredByGlob('./src/posts/*.md').filter(livePosts),
].reverse();
});

config.addCollection('demos', (collection) => {
return [...collection.getFilteredByGlob('./src/demos/*.md')].reverse();
});

config.addCollection('postFeed', (collection) => {
return [...collection.getFilteredByGlob('./src/posts/*.md').filter(livePosts)]
.reverse()
.slice(0, site.maxPostsPerPage);
});

config.addCollection('docs', (collection) => {
return [...collection.getFilteredByGlob('./src/docs/*.md')].reverse();
});

config.addCollection('docsOrdered', (collection) => {
const docs = collection.getFilteredByGlob('src/docs/*.md').sort((a, b) => {
return Number(a.data.order) - Number(b.data.order);
});
return docs;
});

// Plugins
config.addPlugin(rssPlugin);
config.addPlugin(syntaxHighlight);
config.addPlugin(eleventyNavigationPlugin);

// 404
config.setBrowserSyncConfig({
callbacks: {
ready: function (err, browserSync) {
const content_404 = fs.readFileSync('dist/404.html');

browserSync.addMiddleware('*', (req, res) => {
// Provides the 404 content without redirect.
res.write(content_404);
res.end();
});
},
},
});

return {
dir: {
input: 'src',
output: 'dist',
},
passthroughFileCopy: true,
};
// Filters
config.addFilter('dateFilter', dateFilter);
config.addFilter('markdownFilter', markdownFilter);
config.addFilter('w3DateFilter', w3DateFilter);

// Layout aliases
config.addLayoutAlias('home', 'layouts/home.njk');

// Transforms
config.addTransform('htmlmin', htmlMinTransform);
config.addTransform('parse', parseTransform);

// Passthrough copy
config.addPassthroughCopy('src/images');
config.addPassthroughCopy('src/js');
config.addPassthroughCopy('src/admin/config.yml');
config.addPassthroughCopy('src/admin/previews.js');
config.addPassthroughCopy({
'../../node_modules/nunjucks/browser/nunjucks-slim.js':
'node_modules/nunjucks/browser/nunjucks-slim.js',
});

const now = new Date();

// Custom collections
const livePosts = (post) => post.date <= now && !post.data.draft;
config.addCollection('posts', (collection) => {
return [
...collection.getFilteredByGlob('./src/posts/*.md').filter(livePosts),
].reverse();
});

config.addCollection('demos', (collection) => {
return [...collection.getFilteredByGlob('./src/demos/*.md')].reverse();
});

config.addCollection('postFeed', (collection) => {
return [...collection.getFilteredByGlob('./src/posts/*.md').filter(livePosts)]
.reverse()
.slice(0, site.maxPostsPerPage);
});

config.addCollection('docs', (collection) => {
return [...collection.getFilteredByGlob('./src/docs/*.md')].reverse();
});

config.addCollection('docsOrdered', (collection) => {
const docs = collection.getFilteredByGlob('src/docs/*.md').sort((a, b) => {
return Number(a.data.order) - Number(b.data.order);
});
return docs;
});

// Plugins
config.addPlugin(rssPlugin);
config.addPlugin(syntaxHighlight);
config.addPlugin(eleventyNavigationPlugin);

// 404
config.setBrowserSyncConfig({
callbacks: {
ready: function (err, browserSync) {
const content_404 = fs.readFileSync('dist/404.html');

browserSync.addMiddleware('*', (req, res) => {
// Provides the 404 content without redirect.
res.write(content_404);
res.end();
});
},
},
});

return {
dir: {
input: 'src',
output: 'dist',
},
passthroughFileCopy: true,
};
};
10 changes: 5 additions & 5 deletions packages/docs/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"printWidth": 90,
"useTabs": true,
"tabWidth": 2,
"singleQuote": true,
"bracketSpacing": false
"printWidth": 90,
"useTabs": false,
"tabWidth": 3,
"singleQuote": true,
"bracketSpacing": false
}
2 changes: 1 addition & 1 deletion packages/docs/php-docs/pattern-states.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The three default states included with Pattern Lab might not be enough for every
You can use the following as your CSS template for new pattern states:

```css
{% raw %}.newpatternstate:before {
{% raw %}.newpatternstate::before {
color: #B10DC9 !important;
}{% endraw %}
```
Expand Down
14 changes: 7 additions & 7 deletions packages/docs/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ const nodeResolve = require('rollup-plugin-node-resolve');
const json = require('rollup-plugin-json');

export default {
input: 'src/admin/util',
output: {
file: 'dist/admin/util.js',
format: 'iife',
name: 'previewUtil',
},
plugins: [builtins(), nodeResolve(), commonjs(), json()],
input: 'src/admin/util',
output: {
file: 'dist/admin/util.js',
format: 'iife',
name: 'previewUtil',
},
plugins: [builtins(), nodeResolve(), commonjs(), json()],
};
16 changes: 8 additions & 8 deletions packages/docs/src/_data/global.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module.exports = {
random() {
const segment = () => {
// eslint-disable-next-line no-bitwise
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
};
return `${segment()}-${segment()}-${segment()}`;
},
now: Date.now(),
random() {
const segment = () => {
// eslint-disable-next-line no-bitwise
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
};
return `${segment()}-${segment()}-${segment()}`;
},
now: Date.now(),
};
16 changes: 8 additions & 8 deletions packages/docs/src/_data/helpers.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module.exports = {
getNextHeadingLevel(currentLevel) {
return parseInt(currentLevel, 10) + 1;
},
getReadingTime(text) {
const wordsPerMinute = 200;
const numberOfWords = text.split(/\s/g).length;
return Math.ceil(numberOfWords / wordsPerMinute);
},
getNextHeadingLevel(currentLevel) {
return parseInt(currentLevel, 10) + 1;
},
getReadingTime(text) {
const wordsPerMinute = 200;
const numberOfWords = text.split(/\s/g).length;
return Math.ceil(numberOfWords / wordsPerMinute);
},
};
40 changes: 20 additions & 20 deletions packages/docs/src/_data/styleguide.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
const tokens = require('./tokens.json');

module.exports = {
colors() {
let response = [];
colors() {
let response = [];

Object.keys(tokens.colors).forEach((key) => {
response.push({
value: tokens.colors[key],
key,
});
});
Object.keys(tokens.colors).forEach((key) => {
response.push({
value: tokens.colors[key],
key,
});
});

return response;
},
sizes() {
let response = [];
return response;
},
sizes() {
let response = [];

Object.keys(tokens['size-scale']).forEach((key) => {
response.push({
value: tokens['size-scale'][key],
key,
});
});
Object.keys(tokens['size-scale']).forEach((key) => {
response.push({
value: tokens['size-scale'][key],
key,
});
});

return response;
},
return response;
},
};
Loading

0 comments on commit fac6ad4

Please sign in to comment.