Sass.compile(scssText, function (r) {
     if (scssText.substr(0,5) === "//!NA") {
         cssEditor.setValue(r.text, -1);
     } else {
         cssEditor.setValue(autoprefixer.process(r.text).css, -1);
     }
 });
Exemple #2
0
		Object.keys(files).forEach(function (file) {
			if (!isCss(file)) {
				return;
			}
			const data = files[file];
			data.contents = new Buffer(autoprefixer.process(data.contents.toString()).css);
		});
      var onTarget = function (target, callback) {
        var target_filename = path.join(project_dirname, target);

        var css_files = groups[target] || [];
        var css_code = '';

        css_files.forEach(function (file) {
          var filename = path.join(project_dirname, file);
          var css_part_code = fs.readFileSync(filename, 'utf8');
          var css_part = rework(css_part_code);

          var filename_rel_to_target = path.relative(
            path.dirname(target_filename),
            path.dirname(filename)
          );

          var fixUrl = function (url) {
            if (url[0] === '.') {
              var url_rel_to_target = path.join(filename_rel_to_target, url);
              return url_rel_to_target;
            }
            return url;
          };
          css_part.use(rework_url(fixUrl));

          css_code += css_part.toString();
        });

        var css = rework(css_code);
        css.use(rework_svg(path.dirname(target)));
        if (rework_flags.at2x) {
          css.use(rework_at2x());
        }
        if (rework_flags.colors) {
          css.use(rework_colors());
        }
        if (rework_flags.extend) {
          css.use(rework_inherit());
        }
        if (rework_flags.ease) {
          css.use(rework_ease());
        }
        if (rework_flags.references) {
          css.use(rework_references());
        }

        var css_result = css.toString({
          compress: minify
        });

        if (rework_flags.autoprefixer) {
          var autoprefixer = new Autoprefixer({
            browsers: rework_flags.autoprefixer
          });
          css_result = autoprefixer.process(css_result).css;
        }

        fs.writeFile(target_filename, css_result, callback);
      };
 .render(function(err, output){
     if (err) {
         return done(err);
     }
     var prefixed = autoprefixer.process(output).css;
     var cssFile = stylFile.replace(".styl", ".css");
     fs.writeFileSync(cssFile, prefixed, 'utf8');
     grunt.log.ok("Created '" + cssFile + "'");
     process(list);
 });
Exemple #5
0
style.render(function(err, css) {
    if (err) {
        console.error(err);
        process.exit(1);
    }
    if (!ie) {
        css = autoprefixer.process(css).css;
    }
    process.stdout.write(css);
});
Exemple #6
0
    }, function(err, result) {
      if (err) {
        var prettyError =
          renderError('You have errors in of your Sass file(s):', err.formatted)

        if (shouldFail) {
          callback(err.formatted, null)
        } else {
          callback(null, prettyError)
        }
      } else {
        autoprefixer
          .process(result.css)
          .then(function(result2) {
            callback(null, result2.css)
          })
      }
    })
Exemple #7
0
 style.on('end', function(err, css){
   if (args.length) { return ap.apply(ap, args).process(css).css; }
   return ap.process(css).css;
 });
var debug = false;

var input_file = "./src/style/style.scss";
var output_file = './public/style/style.css';

if (process.env.NODE_ENV !== "production"){
	debug = true;
}

try {
	var render_css = sass.renderSync({
		file: input_file,
		outputStyle: (debug ? 'nested' : "compact"),
		sourceComments: debug
	});
	var prefixed = autoprefixer.process(render_css.css).css;
	if (debug) {
		// Development
		fs.writeFile(output_file, prefixed, function(err,data){
			process.exit(code=0);
		});
	} else {
		// Production
		var optimized = combinemq.parseCssString(prefixed, {
			beautify : debug
		});
		fs.writeFile(output_file, optimized, function(err,data){
			process.exit(code=0);
		});
	}
Exemple #9
0
function cssTransform(css) {
  return autoprefixer.process(css).css;
}
Exemple #10
0
	function prefix(file, cb) {
		file.contents(autoprefixer.process(file.contents(), browserVersions).css);
		cb(null, file);
	}
Exemple #11
0
    var render = processors[ext].compile(srcPath, dirs, data, function(err, css) {
      if (err) return callback(err);

      var prefixed = autoprefixer.process(css).css;
      callback(null, prefixed);
    })
Exemple #12
0
app.get('/styles.css', (req, res) => {
  const { css } = autoprefixer.process(fs.readFileSync(`${process.cwd()}/styles.css`));

  res.header("Content-type", "text/css");
  res.send(css);
});
 styles.forEach(function (file, index, arr) {
   files[file].contents = new Buffer(autoprefixer.process(files[file].contents.toString()).css);
 });
Exemple #14
0
 stream.on('data', function (newFile) {
   String(newFile.contents).should.equal(autoprefixer.process(testfile).css);
   done();
 });
Exemple #15
0
 data.contents.pipe(es.wait(function (err, data) {
   String(data).should.equal(autoprefixer.process(testfile).css);
   done();
 }));
Exemple #16
0
 success: function(css){
   var prefixed = autoprefixer.process(css).css
   fs.writeFile(outFile, prefixed, cb)
 },
 this.on('end', function (err, css) {
     return args ?
         autoprefixer.apply(this, args).process(css).css :
         autoprefixer.process(css).css;
 });
Exemple #18
0
 .then(function(buffers) {
     return ap.process(buffers.map(function(b) { return b.toString(); })).css;
 });