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 -
            this.emit('error', new PluginError(PLUGIN_NAME, 'Streams not supported!'));
        } else if (file.isBuffer()) {
            // file.contents is a Buffer -
            var doc = scratchblocks.parse(file.contents.toString())
            doc.render(svg => {
                var string = doc.exportSVGString();
                // Remove invalid xmlns attribute due to issue
                string = string.replace(


Make pictures of Scratch blocks from text.

Latest version published 7 months ago

Package Health Score

68 / 100
Full package analysis

Popular scratchblocks functions