Skip to content
This repository has been archived by the owner on Jun 21, 2021. It is now read-only.

SugarSS support #159

Closed
wants to merge 4 commits into from
Closed
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: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-stylefmt",
"displayName": "stylefmt",
"description": "Modern CSS Formatter",
"version": "2.5.0",
"version": "2.6.0",
"publisher": "mrmlnc",
"license": "MIT",
"engines": {
Expand All @@ -29,7 +29,8 @@
"onLanguage:css",
"onLanguage:postcss",
"onLanguage:less",
"onLanguage:scss"
"onLanguage:scss",
"onLanguage:sugarss"
],
"main": "./out/extension",
"contributes": {
Expand All @@ -49,7 +50,10 @@
"description": "Base working directory; useful for stylelint extends parameter."
},
"stylefmt.config": {
"type": ["string", "object"],
"type": [
"string",
"object"
],
"default": "",
"description": "Config object for stylelint or path to a stylelint config file."
},
Expand Down Expand Up @@ -88,6 +92,7 @@
"extend": "3.0.1",
"postcss": "6.0.8",
"postcss-scss": "1.0.2",
"sugarss": "2.0.0",
"stylefmt": "6.0.0",
"vscode": "1.1.5"
},
Expand All @@ -100,4 +105,4 @@
"build": "npm run clean && npm run lint && npm run compile && npm t",
"watch": "npm run clean && npm run lint && npm run compile -- --sourceMap --watch"
}
}
}
3 changes: 2 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export function activate(context: vscode.ExtensionContext) {
{ language: 'css', scheme: 'file' },
{ language: 'postcss', scheme: 'file' },
{ language: 'less', scheme: 'file' },
{ language: 'scss', scheme: 'file' }
{ language: 'scss', scheme: 'file' },
{ language: 'sugarss', scheme: 'file' }
];

// For plugin command: "stylefmt.execute"
Expand Down
5 changes: 4 additions & 1 deletion src/stylefmt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as vscode from 'vscode';

import * as postcss from 'postcss';
import * as scssSyntax from 'postcss-scss';
import * as sugarss from 'sugarss';
import * as stylefmt from 'stylefmt';

import * as settingsManager from './settings-manager';
Expand All @@ -26,9 +27,11 @@ export function use(settings: Types.ISettings, document: vscode.TextDocument, ra
text = document.getText(range);
}

const isSugarss = document.languageId === 'sugarss';

const postcssConfig: postcss.ProcessOptions = {
from: document.uri.fsPath || rootDirectory || '',
syntax: scssSyntax
syntax: isSugarss ? sugarss : scssSyntax
};

const postcssPlugins: postcss.AcceptedPlugin[] = [
Expand Down
7 changes: 7 additions & 0 deletions typings/sugarss.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
declare module 'sugarss' {
import postcss = require('postcss');

const postcssSugarss: postcss.ProcessOptions;

export = postcssSugarss;
}