Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

postcss-hamster

h0tc0d353Apache 2.01.3.0

PostCSS Hamster

css, postcss, baseline grid, vertical rhythm, typography, sass, compass, ruler

readme

PostCSS Hamster Framework

Typography, Vertical Rhythm, Modular Scale, Fluid Responsive Typography functions for CSS. Flexible system with high performance.

Hamster Framework - it's the language of macros and functions, which in the future can be easily transformed into css code and any units. Easy adapted to any user browser resolution.

If your company uses the plugin, then you can contact me and I can attach for free your company logo in main page https://hamster.im.

Support / Discussion: Gitter.

Documentation: RU

Big article with examples how to use Hamster Framework RUSSIAN

CSS Code: Examples

Installation

Be careful if you use precss and cssnext. You need to disable "lookup" plugin in precss and "rem" in cssnext. They interfere and the hamster plug-in expands their functionality.

npm install postcss-hamster

PostCSS


var fs = require("fs"),
    postcss = require("postcss"),
    hamster = require("postcss-hamster");

fs.readFile("filename.css", "utf8", (err, css) => {
    postcss([hamster]).process(css).then(result => {
        fs.writeFileSync("outputfilename.css", result.css);
    });
});

Gulp

If you are using postcss-gulp then install version 6.4.0. postcss-gulp@7.0.0 + precss have bug, and @import can't work correctly.

npm install gulp-postcss@6.4.0

var gulp = require("gulp"),
    sourcemaps = require("gulp-sourcemaps"),
    postcssgulp = require("gulp-postcss"),
    precss = require("precss"),
    autoprefixer = require("autoprefixer");
    hamster = require("postcss-hamster");

gulp.task("css", function () {

    var processors = [precss({
        "lookup": false
    }), hamster, autoprefixer({
        browsers: ["> 0.5%"]
    })];

    return gulp.src("./web/src/style.css")
       .pipe(sourcemaps.init())
       .pipe(postcssgulp(processors))
       //.pipe(cssnano())
       .pipe(sourcemaps.write("."))
       .pipe(gulp.dest("./web/css"));
});

gulp.task("default", ["css"]);

changelog

Changelog

1.0.0

  • Initial version.

1.1.0

  • Performance optimization and refactoring.

1.2.0 - beta

  • Add postcss 6 support.
  • Add @sanitize - add sanitize.css(fork normalize)
  • Update Normalize to v7
  • Add @box-sizing-reset - box-sizing reset.
  • Add @copy and @paste macros for copy paste css code.
  • Add short macros for fontsize like "fs base"
  • Add short macros for lineheight() function - lheight().
  • Add @hamster reset; for hard reset hamster global settings.
  • Add base() function for get base font size fraction.
  • Add responsive viewport sizes with unit: vw.
  • Add @ihamster alias for @!hamster.(Some IDE swear a @!).
  • Fix Helpers.toCamelCase() function bug.
  • Split px-fallback to px-fallback for pixels and rem-fallback for rem.
  • Update documentation and web demo.

1.2.0 - rc3

  • Add use-global: true setting. It's calculate ratio = localFontSize / globalFontSize. And all value will multiplied with this ration. It's make responsive sizes in em and rem without establish baseline.

1.3.0

  • Fix PX rhythm grid.
  • Add macros @center; @center flex; @center transform;
  • Add macros @hide; @hide text;