Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@shopmacher/trinity

Package Overview
Dependencies
Maintainers
5
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopmacher/trinity

Media query mixins for multiple devices and grid systems using LESS

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

Trinity

Trinity is a less library for handling reponsive breakpoints of devices and frameworks painlessly.

Table of contents

Installation

Trinity can be installed via npm. Simply type:

npm i -S @shopmacher/trinity

After installing trinity, you can integrate it in your project depending on what build engine you use.

webpack

If you use webpack as your build engine, make sure you have a less-loader set up. Then you can include trinity either in your less file using

@import '~@shopmacher/trinity/lib/trinity.less';

Other build engines

For any other build engine besides webpack, make sure to include the following file in your less bundle:

node_modules/@shopmacher/trinity/lib/trinity.less

Usage

Trinity provides a set of breakpoints and mixins for different screen sizes and UI frameworks. This section shows, how to use the trinity mixins for the different devices.

General

All mixins are used in a similar way, which is:

.device({
    // Styles for the device here
});

Simply replace device with a device from one of the devices-sections below, as in this example for a mobile device in landscape orientation:

.mobile-landscape({
    // Mobile landscape styles here
});

If you do not want to use the mixins, you always have the option to use the @media keyword in conjunction with the breakpoints.

@media @mobile {
    // Mobile styles here
}

Min-width mixins

In some cases, you want to provide style for a specific screen size and all above that one. For example: mobile and above. For this, trinity allows you to add the -up suffix, to every mixin available including orientations.

.mobile-up({
    // This styles mobile and larger devices (tablet, desktop)
)}

Custom breakpoints

If the built-in breakpoints are not sufficient for you, there is a mixin to use custom breakpoints.

@min: 300px;
@max: 500px;

.responsive(@min, @max, {
    // This styles devices from @min to @max width
});

.reponsive(@min, {
    // This styles devices from @min width and up
});

Devices and breakpoints

The following tables show the different built-in devices and breakpoints.

Mobile

Devicemin-widthmax-width
mobilemobile-minmobile-max
mobile-portrait""
mobile-landscape""
BreakpointValue
mobile-min320px
mobile-max480px

Tablet

Devicemin-widthmax-width
tablettablet-mintablet-max
tablet-portrait""
tablet-landscape""
BreakpointValue
tablet-min768px
tablet-max1024px

Desktop

Devicemin-widthmax-width
desktopdesktop-min-
BreakpointValue
desktop-min1025px

Bootstrap

If you use the bootstrap framework, you can use the following breakpoints as they reflect the ones bootstrap uses.

Mixinmin-widthmax-width
xs0xs-max
smsm-minsm-max
mdmd-minmd-max
lglg-min-
BreakpointValue
xs-max768px
sm-min769px
sm-max991px
md-min992px
md-max1199px
lg-min1200px

Todo

  • Implement generic mobile, tablet and desktop devices
  • Implement bootstrap breakpoints
  • Document usage
  • Provide examples
  • Add specific devices, like iPhones
  • Add support for em media queries

Contributing

In order to make contributions to the project, fork the project and create a feature/hotfix branch with the contribution you want to make.

When you finished developing, document the changes and submit a pull request.

Of course, you can always submit issues for bugs or feature-requests.

License

MIT

Keywords

FAQs

Package last updated on 08 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc