first ready to use implementation
This commit is contained in:
16
dist/index.d.ts
vendored
Normal file
16
dist/index.d.ts
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
import { Result } from 'node-sass';
|
||||
export interface ISmartsassConstructorOptions {
|
||||
entryFilePath: string;
|
||||
}
|
||||
export declare class Smartsass {
|
||||
entryFilePath: string;
|
||||
constructor(optionsArg: ISmartsassConstructorOptions);
|
||||
/**
|
||||
* renders the Smartsass classes' entryfile and returns result as string
|
||||
*/
|
||||
render(): Promise<Result>;
|
||||
/**
|
||||
* renders and stores
|
||||
*/
|
||||
renderAndStore(outputFilePath: string): Promise<void>;
|
||||
}
|
43
dist/index.js
vendored
Normal file
43
dist/index.js
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const plugins = require("./smartsass.plugins");
|
||||
class Smartsass {
|
||||
constructor(optionsArg) {
|
||||
this.entryFilePath = optionsArg.entryFilePath;
|
||||
}
|
||||
/**
|
||||
* renders the Smartsass classes' entryfile and returns result as string
|
||||
*/
|
||||
render() {
|
||||
let done = plugins.smartq.defer();
|
||||
plugins.sass.render({
|
||||
file: this.entryFilePath
|
||||
}, function (err, result) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
done.reject(err);
|
||||
}
|
||||
done.resolve(result);
|
||||
});
|
||||
return done.promise;
|
||||
}
|
||||
/**
|
||||
* renders and stores
|
||||
*/
|
||||
renderAndStore(outputFilePath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let result = yield this.render();
|
||||
yield plugins.smartfile.memory.toFs(result.css.toString(), outputFilePath);
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.Smartsass = Smartsass;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsK0NBQThDO0FBUzlDO0lBRUUsWUFBWSxVQUF3QztRQUNsRCxJQUFJLENBQUMsYUFBYSxHQUFHLFVBQVUsQ0FBQyxhQUFhLENBQUE7SUFDL0MsQ0FBQztJQUVEOztPQUVHO0lBQ0gsTUFBTTtRQUNKLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUF1QixDQUFBO1FBQ3RELE9BQU8sQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDO1lBQ2xCLElBQUksRUFBRSxJQUFJLENBQUMsYUFBYTtTQUN6QixFQUFFLFVBQVUsR0FBRyxFQUFFLE1BQU07WUFDdEIsRUFBRSxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQztnQkFDUixPQUFPLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFBO2dCQUNoQixJQUFJLENBQUMsTUFBTSxDQUFDLEdBQUcsQ0FBQyxDQUFBO1lBQ2xCLENBQUM7WUFDRCxJQUFJLENBQUMsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFBO1FBQ3RCLENBQUMsQ0FBQyxDQUFBO1FBQ0YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7SUFDckIsQ0FBQztJQUVEOztPQUVHO0lBQ0csY0FBYyxDQUFFLGNBQXNCOztZQUMxQyxJQUFJLE1BQU0sR0FBRyxNQUFNLElBQUksQ0FBQyxNQUFNLEVBQUUsQ0FBQTtZQUNoQyxNQUFNLE9BQU8sQ0FBQyxTQUFTLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLFFBQVEsRUFBRSxFQUFFLGNBQWMsQ0FBQyxDQUFBO1FBQzVFLENBQUM7S0FBQTtDQUNGO0FBOUJELDhCQThCQyJ9
|
5
dist/smartsass.plugins.d.ts
vendored
Normal file
5
dist/smartsass.plugins.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import 'typings-global';
|
||||
import * as sass from 'node-sass';
|
||||
import * as smartfile from 'smartfile';
|
||||
import * as smartq from 'smartq';
|
||||
export { sass, smartfile, smartq };
|
10
dist/smartsass.plugins.js
vendored
Normal file
10
dist/smartsass.plugins.js
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("typings-global");
|
||||
const sass = require("node-sass");
|
||||
exports.sass = sass;
|
||||
const smartfile = require("smartfile");
|
||||
exports.smartfile = smartfile;
|
||||
const smartq = require("smartq");
|
||||
exports.smartq = smartq;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzYXNzLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHNhc3MucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2QixrQ0FBaUM7QUFLL0Isb0JBQUk7QUFKTix1Q0FBc0M7QUFLcEMsOEJBQVM7QUFKWCxpQ0FBZ0M7QUFLOUIsd0JBQU0ifQ==
|
Reference in New Issue
Block a user