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

generator-lancelot

v0.1.11

Published

A generator for IC

Downloads

6

Readme

generator-lancelot

A generator for Yeoman.
高速化を念頭に置いて作成したIC用ジェネレータです。

About giraffe

機能

  • ディレクトリの初期構築
  • CoffeeScriptのコンパイル
  • Sassのコンパイル
  • cssファイルの結合&圧縮
  • jsHintによるチェック
  • cssLintによるチェック
  • cssの重複プロパティチェック
  • cssの不要プレフィックス削除
  • este-watchによるファイル更新の監視→コンパイル・結合・圧縮・デバッグの自動化
  • 自動ブラウザリロード
  • mixinライブラリ(bourbon)を搭載
  • 最新normalize/modernizr/font-awesomeの取得
  • spritesmithによるsprite作成
  • svgstoreによるsprite作成
  • grunt-kssによるスタイルガイド生成
  • 各種mixinなどのscssライブラリを追加
  • Jadeに対応
  • browserifyによるjsのモジュール管理と結合
  • Jasmineによるテスト

Install

使用する前に以下のツール群をインストールする必要があります。
一部古いNode.jsに対応していないものもあるため、 バージョンが古い場合は、できるだけアップデートしておくことを推奨します。
Windows環境ではRubyのインストール、MacとWindow両方ともSass/Compassのインストールが前提になります。

$ npm install -g yo grunt-cli bower
$ gem install csscss

How to use

generator-lancelotをインストールします。

npm install -g generator-lancelot

任意のディレクトリを作成して移動し、yo giraffe & grunt startを実行します。
環境によっては実行前にgit config --global url."https://".insteadOf git://を実行する必要があります。

mkdir hogehoge
cd hogehoge
yo lancelot && grunt start

yeomanからの質問形式で以下の設定を行います。

  • 開発者名(packageのauthorに入ります)
  • ルートディレクトリ名
  • FontAwesomeを使用するかどうか
  • 共通リソースディレクトリ名
  • コンパイル言語ファイルの格納先
  • ドキュメントディレクトリ名

質問に返答後、返答内容に応じたディレクトリが構成され、
node_module等が自動的にインストールされます。

####js,cssファイルの結合

Gruntfile.jsを開き、結合したいcss,jsのパスを通します。
上から順に結合されていくので、順番を間違えないようにしてください。
ちなみにGrunt.jsにおいてルート相対・絶対パスは認識されません。

concat: {
	style: {
		src: [
			'<%= path.root %>/<%= path.src %>/css/normalize.css',
			'<%= path.root %>/<%= path.src %>/css/hogehoge.css'
		],
		dest: '<%= path.root %>/<%= path.src %>/css/dest/style-all.css'
	}
},

ファイル監視の起動

grunt watch_filesコマンドでGrunt.jsで設定したページが開き、ファイルの監視が始まります。 Sublime Text2でlivereloadのプラグインを入れてる人は、バッティングするのでプラグインをremoveしてから使ってください。
この後、コンソールは出したままにしておいてください。最小化しても大丈夫です。
以降はscss/coffee(Sassのみの時)が更新される度に自動的にコンパイル・結合・圧縮・デバッグが行われます。 さらに、htmlとcss(sassを使っている人はscss更新時)の更新時に自動でブラウザがリロードされます。
コンソールは消さずに出したままにしておいてください。監視をやめたい場合はコンソール上でCtrl+Cを押してください。   任意のタイミングでコンパイル・結合・圧縮・デバッグを行いたい場合はgruntコマンドを打ち込んでください。

livereloadのアドオン・エクステンションを取得

Firefox
http://feedback.livereload.com/knowledgebase/articles/86242-how-do-i-install-and-use-the-browser-extensions-
「Firefox extension」というやつです。

Chrome
https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei

あとは追加されたアドオンのマークを押して、丸の中が赤くなれば成功です。
ファイル監視を行っている最中に行ってください。
後はhtmlまたはcss(sassの人はscss)を編集して保存した際にブラウザがリロードされればok。

styleguideの作成

grunt styleguideコマンドで作成が始まります。初期設定ではtemplate格納先はstyleguide_tempフォルダに、出力先はmodulesフォルダ内に設定されています。

重複プロパティのチェックとcss・jsのlint/hintチェック

grunt checkを叩くと重複プロパティのチェックとcss/jsのlint/hintが始まります。初期設定では/common/css/destと/common/js/dest内にチェックの指定先が設定されています。lintの設定等はGruntfile.jsを書き換えて設定可能です。

不要プレフィックスのチェック

不要なプレフィックスを削除するためにautoprefixerを使用しています。ブラウザのバージョン指定はGruntfile.jsの下記部分になります。こちらのバージョンは変更可能です。下記リンクを参考にしてください。

/* cssファイルの不要prefix消去
 ------------------------------------------------------------------------*/
autoprefixer: {
	options: {
		// ブラウザのバージョン指定
		browsers: ['last 2 version', 'ie 8']
	},
	no_dest: {
		src: '<%= path.root %>/<%= path.src %>/css/dest/*.css'
	}
},

スプライトシートの作成

Compassで毎回書き出すと遅くなるので、Compassのスプライトシート生成はgrunt-spritesmithで代用しています。grunt spriteImageを叩くとスプライトシートの生成が始まります。初期設定では/common/img/sprite内のpng画像が結合され、/common/img/にsprite.pngとして書き出されます。また、スタイルの設定ファイルは/common/compile/scss/lib/_sprite.scssに上書きされます。

同様にgrunt spriteSVGを叩くとSVGスプライトシートの生成が始まります。

License

MIT License