smartsass/dist/index.js

43 lines
2.7 KiB
JavaScript

"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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsK0NBQThDO0FBUzlDO0lBRUUsWUFBWSxVQUF3QztRQUNsRCxJQUFJLENBQUMsYUFBYSxHQUFHLFVBQVUsQ0FBQyxhQUFhLENBQUE7SUFDL0MsQ0FBQztJQUVEOztPQUVHO0lBQ0gsTUFBTTtRQUNKLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUF1QixDQUFBO1FBQ3RELE9BQU8sQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDO1lBQ2xCLElBQUksRUF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