npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

assemble-code

v1.0.4

Published

Code blocks for the Assemble CSS Framework.

Downloads

11

Readme

Assemble Code

Assemble Code is a component of the Assemble CSS Framework. It will give you a solid base for displaying code in your project. It has some default styles that can easily be overridden so you can add your own look.

Requirements

Assemble Code requires Assemble Base.

Installation

npm install assemble-code --save-dev

Usage

Import the _assemble-code.css file from your css file.

@import '../node_modules/assemble-base/base';

/*
Override variables here before the Assemble Components are loaded.
*/

@import '../node_modules/assemble-code/assemble-code';

Use the code tag as you normally could.

<code>
    <a class="btn  btn--primary">Button</a>
</code>

Options

Options are set with variables. These variables are already set with their default values so they will just work out of the box. If you wish to change them just define the variable you want to change before you load the _assemble-code.css file. You may wish you see Assemble Base for more examples and directions for setting up a Assemble project.

Design Variables

$code-background-color
  • Set background color for code blocks.
  • Default: #F7F7F9;
  • Type: Color
$code-background-color: #EEE;
$code-border
  • Set if code blocks should have a border.
  • Default: true
  • Type: Boolean
$code-border: false;
$code-border-color
  • Set border color of code blocks.
  • Default: #C0C0C0;
  • Type: Color
  • Only used if $code-border is true.
$code-border-color: #999;
$code-border-size
  • Set border size of code blocks.
  • Default: 1px;
  • Type: Number
  • Only used if $code-border is true.
$code-border-size: 2px;
$code-border-type
  • Set border style of code blocks.
  • Default: solid;
  • Type: String
  • Only used if $code-border is true.
$code-border-type: dashed;
$code-color
  • Set color of code blocks.
  • Default: #AD0D36;
  • Type: Color
$code-color: #FFF;
$code-padding
  • Set padding of code blocks.
  • Default: 0.5em;
  • Type: String
$code-paddinge: 5px 7px;
$code-inline-padding
  • Set padding for inline code blocks.
  • Default: 0.2em 0.25em;
  • Type: String
$code-inline-padding: 5px;
$code-scroll-max-height
  • Set height for when a scroll bar should appear for code blocks.
  • Default: 20em;
  • Type: Number
$code-scroll-max-height: 200px;

Modifier Variables

$code-scrollable
  • If this is true you will have a class of .code-scrollable available to you. Once applied scrollbars will show if a code block height is over $code-scroll-max-height.
  • Default: false;
  • Type: Boolean
$code-scrollable: true;

Will give you:

.code-scrollable{
    max-height: $code-scroll-max-height;
    overflow-y: scroll;
}

Usage

<div class="code-scrollable">
    <code>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="description" content="">
        <meta name="keywords" content="">
        <title>Title Here</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="shortcut icon" href="assets/images/favicon.ico" type="image/x-icon">
        <link rel="stylesheet" href="stylesheets/style.css">
        <script src="bower_components/assemble.css/javascript/tip.js"></script>
        <div class="g-single">
            <div class="gc-single-cell">
                Some Code Here
            </div>
        </div>
        <script src="bower_components/assemble.css/javascript/iconic.min.js"></script>
        <script src="bower_components/assemble.css/javascript/vanilla-modal.js"></script>
        <script>
            var modal = new VanillaModal({});
        </script>
    </code>
</div>