How to use scratchblocks - 1 common examples

To help you get started, we’ve selected a few scratchblocks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uccser / cs-unplugged / csunplugged / gulpfile.js View on Github external
return through.obj(function (file, encoding, callback) {
        if (file.isNull()) {
            // nothing to do
            return callback(null, file);
        }

        if (file.isStream()) {
            // file.contents is a Stream - https://nodejs.org/api/stream.html
            this.emit('error', new PluginError(PLUGIN_NAME, 'Streams not supported!'));
        } else if (file.isBuffer()) {
            // file.contents is a Buffer - https://nodejs.org/api/buffer.html
            var doc = scratchblocks.parse(file.contents.toString())
            doc.render(svg => {
                var string = doc.exportSVGString();
                // Remove invalid xmlns attribute due to issue https://github.com/scratchblocks/scratchblocks/issues/219
                string = string.replace(
                    /

scratchblocks

Make pictures of Scratch blocks from text.

MIT
Latest version published 1 year ago

Package Health Score

70 / 100
Full package analysis

Popular scratchblocks functions