{"size": 751, "ext": "js", "max_stars_repo_path": "test/utils/run.js", "max_stars_repo_name": "dante1977/sass-sprite-webpack-plugin", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/utils/run.js", "max_issues_repo_name": "dante1977/sass-sprite-webpack-plugin", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/utils/run.js", "max_forks_repo_name": "dante1977/sass-sprite-webpack-plugin", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.8965517241, "max_line_length": 50, "alphanum_fraction": 0.5992010652}
const fs = require('fs');
const webpack = require('webpack');
const merge = require('webpack-merge');
const config = require('./webpack.config');
const sassSpritePlugin = require('../..');
const { resolve, join } = require('path');

const context = resolve(__dirname, '../mock-app');
const distPath = join(context, 'dist');

module.exports = function (filename, margin) {
  return new Promise(resolve => {
    const compiler = webpack(merge({
      context,
      entry: {
        index: join(context, 'entry.js')
      },
      output: {
        path: distPath
      },
      plugins: [
        new sassSpritePlugin(filename, margin)
      ]
    }, config));
    compiler.run((err, stats) => {
      resolve(stats.compilation.assets);
    });
  });
}