Code Monkey home page Code Monkey logo

sharps's Introduction

Sharps

Modular grid powered by Lost and BEM

Usage

The easiest way:

  1. bower install --save sharps
  2. <link rel="stylesheet" href="./bower_components/sharps/dist/sharps.min.css">

As plugin for postcss:

  1. npm i --save sharps
  2. Prepend your plugins with sharps
const postcss = require('postcss');
const sharps = require('sharps').postcss;

postcss([sharps({
  columns: 12, // default
  maxWidth: '1100px',
  gutter: '10px',
  flex: 'flex'
})]).process('a {color: red}').then(function(result) {
  console.log(result.css);
});

As ENB module:

  1. npm i --save-dev sharps
  2. Add sharps in your ENB config
[require('sharps').enb, {
  config: {
    columns: 12, // default
    maxWidth: '1100px',
    gutter: '10px',
    flex: 'flex'
  }
}]

Note: If you have any css builder, you should change its target and add source to sharps parameters for preventing conflicts, like this:

[techs.stylus, {
  target: '?.no-grid.css', // there is the changed target
  sourcemap: false,
  autoprefixer: {
    browsers: ['ie >= 10', 'last 2 versions', 'opera 12.1', '> 2%']
  }
}],

[require('sharps').enb, {
  config: {
    maxWidth: '1100px',
    gutter: '10px',
    flex: 'flex'
  },
  source: '?.no-grid.css' // there is the source
}]

Easy example

<div class="row">
    <div class="row__col row__col_mw_6">left column</div>
    <div class="row__col row__col_mw_6">right column</div>
</div>
{
  block: 'row',
  content: [
    {
      elem: 'col',
      elemMods: { mw: 6 },
      content: 'left column'
    },
    {
      elem: 'col',
      elemMods: { mw: 6 },
      content: 'right column'
    }
  ]
}

Options

Useful mods for row block:

  • (s|m|l|xl|xxl)al - align cols to left on needed displays

  • (s|m|l|xl|xxl)ac - align cols to center on needed displays

  • (s|m|l|xl|xxl)ar - align cols to right on needed displays

  • (s|m|l|xl|xxl)vat - align cols vertically to top on needed displays

  • (s|m|l|xl|xxl)vam - align cols vertically to middle on needed displays

  • (s|m|l|xl|xxl)vab - align cols vertically to bottom on needed displays

Useful mods for col element:

  • (s|m|l|xl|xxl) - auto width on needed displays

  • (s|m|l|xl|xxl)w - width on needed displays, 0 hide col on this device

  • (s|m|l|xl|xxl)o - offset on needed displays

  • (s|m|l|xl|xxl)of - order first this col on needed displays

  • (s|m|l|xl|xxl)ol - order last this col on needed displays

Authors

Ideas

Please, talk about your ideas by GitHub issues.

MIT License

sharps's People

Contributors

awinogradov avatar djonybastone avatar gitter-badger avatar guria avatar igoradamenko avatar ilyar avatar kompolom avatar lipolyakov avatar tadatuta avatar un1ko85 avatar vkhv avatar voischev avatar yeti-or avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sharps's Issues

bower error Error (1): npm install --production in src/libs/bem-grid

Действия: добавил в bower.json
далее в консли bower-npm-install

Ошибка

bower error Error (1): npm install --production in src/libs/bem-grid

Набор библиотек примерно следующий

{
  "name": "factorymn",
  "version": "0.0.1",
  "description": "factorymn",
  "ignore": [
    ".bem/cache",
    "node_modules",
    "src/libs"
  ],
  "dependencies": {
    "bem-core": "v2.3.0",
    "bem-components": "https://github.com/bem/bem-components.git#87fd52fc0c694aa31c992d20c9cf382ab5ae8c4b",
    "manufactura-bl": "[email protected]:manufactura/manufactura-bl.git#ce5f3b70cfaac18307f1d3e48b6a5d5572f00796",
    "bem-social": "https://github.com/voischev/bem-social.git#6c20d44f9ac62270b463a75ff9205b806a21bc8c",
    "bem-factory": "https://github.com/factorymn/bem-factory.git#d8d967d286c191a99ba2c1a6fb05de52bd620ee6",
    "bem-grid": "https://github.com/verybigman/bem-grid.git#1b77db02907cb2840883120004aabb083d72f2b0"
  },
  "resolutions": {
    "bem-core": "v2.3.0",
    "bem-components": "87fd52fc0c694aa31c992d20c9cf382ab5ae8c4b"
  }
}

Не понял в чем ошибка помоги разобраться.

Calc

Think about CSS calc() function. Examples here

Problem: expected "indent", got "ident padding"

Hello, i have some problem with stylus and bem-grid:

   84| ctx = '.row'
   85| 
   86| row(nest = false)
   87| 
   88|     if nest
------------------^
   89|         padding: 0
   90|     else
   91|         padding-left:   remify(row_padding)

expected "indent", got "ident padding"

Some gap helpers for cells?

E.g.

{ block: 'row', gap: 15, content: [
  { elem: 'col', content: 'gap 15' },
  { elem: 'col', gap: 10, content: 'gap 10' }
] }

Your thoughts?

mq: больше 3 бейкпоинтов

Сейчас есть возможность разложить сетку в 3 состояния экрана в 3 брейк поинта.
Что делать если например нужно 5 состояний экрана?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.