Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including gulp-import-css with all npm packages installed. Try it out:

var gulpImportCss = require("gulp-import-css")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

gulp-import-css v0.1.3

Import several css files into a single file, one by one, rebasing urls and inlining @import

gulp-import-css

Import several css files into a single file, one by one, rebasing urls and inlining @import

Install

Install with npm.

npm install --save-dev gulp-import-css

Examples

Let's say you have assets/reset.css:

body {margin: 0}

assets/home.css:

@import url('reset.css');
/* Important: can't be @import 'reset.css' */
.home {font-size: 14px; }

After gulp you get dist/home.css:

body {
  margin: 0;
}

/* Important: can't be @import 'reset.css' */

.home {
  font-size: 14px;
}

This is the Gulpfile.js:

var gulp = require('gulp');
var importCss = require('gulp-import-css');

gulp.task('default', function () {
  gulp.src('assets/home.css')
    .pipe(importCss())
    .pipe(gulp.dest('dist/'));
});

Now, run the command gulp to get the combined css file.

License

MIT @ yuguo

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free