How to use strip-comments - 6 common examples

To help you get started, we’ve selected a few strip-comments 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 tangrams / tangram / src / gl / shader_program.js View on Github external
ensureUniforms(uniforms) {
        if (!uniforms) {
            return;
        }

        var vs = strip(this.computed_vertex_source);
        var fs = strip(this.computed_fragment_source);
        var inject, vs_injections = [], fs_injections = [];

        // Check for missing uniform definitions
        for (var name in uniforms) {
            let vs_defined = GLSL.isUniformDefined(name, vs); // check vertex shader
            let fs_defined = GLSL.isUniformDefined(name, fs); // check fragment shader

            if (!vs_defined || !fs_defined) {
                inject = GLSL.defineUniform(name, uniforms[name]);
                if (!inject) {
                    continue;
                }

                if (!vs_defined) {
                    log('trace', `Program ${this.name}: ${name} not defined in vertex shader, injecting: '${inject}'`);
                    vs_injections.push(inject);
github tangrams / tangram / src / gl / shader_program.js View on Github external
ensureUniforms(uniforms) {
        if (!uniforms) {
            return;
        }

        var vs = strip(this.computed_vertex_source);
        var fs = strip(this.computed_fragment_source);
        var inject, vs_injections = [], fs_injections = [];

        // Check for missing uniform definitions
        for (var name in uniforms) {
            let vs_defined = GLSL.isUniformDefined(name, vs); // check vertex shader
            let fs_defined = GLSL.isUniformDefined(name, fs); // check fragment shader

            if (!vs_defined || !fs_defined) {
                inject = GLSL.defineUniform(name, uniforms[name]);
                if (!inject) {
                    continue;
                }

                if (!vs_defined) {
                    log('trace', `Program ${this.name}: ${name} not defined in vertex shader, injecting: '${inject}'`);
github egoist / mkfile / src / helpers.js View on Github external
export async function getFileByOrder (...files) {
  for (let file of files) {
    if (await pathExists(file)) {
      let data = {
        name: file,
        value: stripComments(await fs.readFile(file, 'utf8'))
      }
      return data
    }
  }
  log('Could not find Makefile in current directory!'.red)
  process.exit()
}
github mohayonao / mml-emitter / src / MMLEmitter.js View on Github external
constructor(source, config = {}) {
    if (config.reverseOctave) {
      source = reverseOctave(source);
    }

    let MMLIteratorClass = config.MMLIterator || MMLIterator;
    let tracks = stripComments(source).split(";");

    tracks = tracks.filter(source => !!source.trim());
    tracks = tracks.map(track => new MMLIteratorClass(track, config));

    super(tracks, config);
  }
}
github airyland / vux-loader / src / libs / import-parser.js View on Github external
const rs = source.split('\n').map(function (line) {
    line = line.replace(/^\s+|\s+$/g, '')
    try {
      line = stripComments.line(line)
    } catch (e) {
    }
    return line
  }).join('\n')
  return rs
github spmjs / serve-spm / lib / parser / css2js.js View on Github external
function css2js(code) {
  return strip
    .block(code)
    .replace(/\n|\r/g, '')
    .replace(/\\/g, '\\\\')
    .replace(/'/g, '"');
}

strip-comments

Strip line and/or block comments from a string. Blazing fast, and works with JavaScript, Sass, CSS, Less.js, and a number of other languages.

MIT
Latest version published 5 years ago

Package Health Score

67 / 100
Full package analysis