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

sgc-free

v2.0.0

Published

sgalinski command line interface (gulp based fronted Toolchain)

Downloads

3

Readme

sgalinski Internet Services

sgalinski command line interface

Please note: The CLI is intended to be used with bash or zsh. In order for scss-lint to work, you need to have ruby installed on your machine.

Installation

Move the 'sgc-core' folder inside your project root and execute the install script.

./sgc-core/install.sh

Local Installation

If you don't want to install the sgc command globally (e.g. in a server environment), just pass the --local flag to the install script.

./sgc-core/install.sh --local

Windows

If you want to install the SGC on a Windows machine, there are some additional preparations are required:

  • All commands are to be executed in git-bash window, do not try to use the cmd! You'll probably already have the git-bash installed if you are using git for Windows.
  • Install NVM for Windows: https://github.com/coreybutler/nvm-windows
  • You might run into an error where the SGC is not able to install the scss_lint ruby gem. This is due to an SSL error with rubygems that occurs on Windows. In this case, you will have to install scss_lint manually. Read more about that error here: https://gist.github.com/luislavena/f064211759ee0f806c88
  • You have to open git-bash with administrator privileges to run the installation script

Configuration

To configure the frontend build process to your needs, you will have to modify the .sgc-config.json that the installer will put into your projects root-directory.

Heads up Prior to SGC 1.2.0, the config file was named config.json and lived inside the sgc-core/gulp folder. If this file is still present, sgc will use it instead of the .sgc-config.json. It is highly advised to use .sgc-config.json instead!

directories

Holds the paths to the css, sass, javascript, images, sprites, sourcemaps and inline-svgs, relative to the extensions root.

  • webPath: path to your extension folder as seen from the web
  • basePath: path to your extension folder as seen from the filesystem

abovethefold (enterprise feature)

Configuration for the critical path css.

  • template: path to the src template
  • dest: path to the destination

js

The SGC will support you with writing next generation JavaScript and executing it in Browsers today, by transpiling it to EcmaScript 5 compliant code. Currently EcmaScript 6 Syntax and TypeScript are supported.

  • compiler: es6|typescript (enterprise feature)
  • libraryPaths: additional locations that should be searched when resolving CommonJS require statements
  • excludeFromQa: *glob patterns with locations that hold JavaScript that does not need to be linted (vendor stuff)

images (enterprise feature)

  • optimize: locations of user uploaded images that should be optimized

extensions

A list of extensions that should be included in the watch task. Please note, that the very first extension in this list is expected to be your project_theme.

browsersync

BrowserSync is a neat tool that will help you during the development and testing process. When you run sgc, it will spin up a small webserver that proxies the URL specified in your .sgc-config.json. If you change a JavaScript or Sass file inside an extension that is on your watch list (see the option above), BrowserSync will automatically reload the page or inject your changes directly into the browser. You can also open several instances of the BrowserSync URL in different browser windows and BS will take care of synchronizing all input and scroll events between them.

Usage

You can run a specific task on a specific component, or start a watcher that will fire up BrowserSync and run tasks when source files change. Extensions that will be watched are defined in your .sgc-config.json file for each project.

If you run a specific task, you need to specify the extension you want the task to run on with the --ext parameter.

sgc css --ext project_base

There are a few available tasks you need to remember:

default/watch task

sgc

Starts a project wide watcher that will trigger the css/javascript task when you change any .scss, or .js-file and opens the website in your browser, as a browsersync session (changed js and css will automatically get injected when recompiled).

Hint: If you already have a browsersync instance open in your browser, you can pass the argument -s to restart the session without opening a browser.

sprite task (will be called by the css task automatically)

sgc css:sprites --ext [extension name]

Triggers sprite generation inside the given directory.

Assumptions:

  • all sprite images are inside images/sprites, relative to the given path.
  • all sprite images are PNGs.
  • there is a sass directory, next to the images folder.

This task will generate a png inside the images folder, containing all the sprites and a .scss file inside the sass folder, which will provide the necessary mixins. To use the sprites inside your SASS code, import the _sprite.scss file. You can then use the following mixins:

// will output css for a sprite image 'box.png'
.element {
	@include sprite ($box);
}

The @sprite mixin already contains width and height. If you need these values for something else, use the @sprite-width and @sprite-height functions.

css:svg task (will be called by the css task automatically)

sgc css:svg --ext [extension name]

Triggers the generation of Sass-mixins for all SVGs inside the given directory. Each mixin will enable the usage of the associated SVG as a css background image.

@import 'svg'; // imports the file with the generated mixins (inside your Sass-root)

.icon-globe {
    @include inline-svg($icon-globe); // inserts the file icon-globe.svg as an inlined background-image
}

css:abovethefold (will be called by the css task automatically) (enterprise feature)

svg css:abovethefold

This task will read the html file you specified as abovethefold.template, read every statement in it and replace it with the css styles the referenced file contains, as an inline style tag. To make use of this feature, you should create a separate css file in your project (abovethefold.scss -> abovethefold.css), as well as an html-template file that references this stylesheet (note that the path needs to be relative to the template file). You can then set this template file as your PageRenderTemplate. All styles inside your abovethefold.css file will now be inlined directly into the HTML of your website. Note that you should think about what to put in this file only styles that should be available directly after the render process on every page should go there.

css task

sgc css --ext [extension name]

Triggers css compilation inside the given directory. Note, that this task will also run the sprite task before it starts.

Assumptions:

  • all scss files are inside the sass directory, relative to the given path.
  • all css files go into the stylesheets directory, relative to the given path.

images task (enterprise feature)

sgc images --ext [extension name]

Optimizes all images for the given path.

Assumptions:

  • all images are inside the image directory, relative to the given path.

optimize images in fileadmin and uploads (enterprise feature)

sgc images:uploaded

This tasks optimizes all images (png, jpg, gif, svg) inside the folders you specified in the sgc-config.json file. You might want to run this task on a regular basis to compress user uploaded media.

Extending the sgc with your own modules (enterprise feature)

You can easily extend the sgc functionality by writing your own modules. Simply create a sgc-scripts folder next to sgc-core and put your custom scripts in there. Right now only shell-scripts with are supported, other languages might follow in the future.

Execute your custom scripts by calling sgc

+ sgc-core
+ sgc-scripts
    - updateInstance.sh
    - updateDeployData.sh
sgc updateInstance

Troubleshooting

Timeouts of the registry while installing the toolchain

Please try to remove the npm-shrinkgwrap.json file and execute the following commands:

cd sgc-core
rm -rf node_modules
npm set registry http://registry.npmjs.org/
npm install