Skip to content

Commit

Permalink
add better RequireJS support
Browse files Browse the repository at this point in the history
  • Loading branch information
desandro committed Jul 20, 2013
1 parent 9183113 commit b830853
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"browser": true,
"devel": true,
"devel": false,
"strict": true,
"undef": true,
"unused": true,
Expand Down
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "masonry",
"version": "3.0.3",
"version": "3.1.0",
"description": "Cascading grid layout library",
"main": "masonry.js",
"dependencies": {
"get-size": "desandro/get-size",
"outlayer": "metafizzy/outlayer#>=0.4.0"
"get-size": "desandro/get-size#>=1.1.4 <2.0",
"outlayer": ">=1.1.0 <2.0"
},
"devDependencies": {
"doc-ready": "desandro/doc-ready",
Expand Down
41 changes: 41 additions & 0 deletions examples/require-js.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">

<title>require js</title>

<link rel="stylesheet" href="examples.css" />
<script data-main="require-js" src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.5/require.js"></script>

</head>
<body>

<h1>require js</h1>

<div id="basic" class="container">
<div class="item"></div>
<div class="item h4"></div>
<div class="item w2 h2"></div>
<div class="item w2"></div>
<div class="item h3"></div>
<div class="item w3"></div>
<div class="item"></div>
<div class="item h4"></div>
<div class="item"></div>
<div class="item w2 h4"></div>
<div class="item w2"></div>
<div class="item h5"></div>
<div class="item w3"></div>
<div class="item"></div>
<div class="item h4"></div>
<div class="item"></div>
<div class="item w2 h5"></div>
<div class="item w2"></div>
<div class="item h3"></div>
<div class="item w3"></div>
<div class="item"></div>
</div>

</body>
</html>
21 changes: 21 additions & 0 deletions examples/require-js.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*global requirejs: false*/

requirejs.config({
baseUrl: '../bower_components'
// OR
// paths: {
// eventie: '../bower_components/eventie',
// 'doc-ready': '../bower_components/doc-ready',
// eventEmitter: '../bower_components/eventEmitter',
// 'get-style-property': '../bower_components/get-style-property',
// 'get-size': '../bower_components/get-size',
// 'matches-selector': '../bower_components/matches-selector',
// outlayer: '../bower_components/outlayer'
// }
});

requirejs( [ '../masonry' ], function( Masonry ) {

new Masonry( document.querySelector('#basic') );

});
6 changes: 3 additions & 3 deletions masonry.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Masonry v3.0.3
* Masonry v3.1.0
* Cascading grid layout library
* http://masonry.desandro.com
* MIT License
Expand Down Expand Up @@ -196,8 +196,8 @@ function masonryDefinition( Outlayer, getSize ) {
if ( typeof define === 'function' && define.amd ) {
// AMD
define( [
'outlayer',
'get-size'
'outlayer/outlayer',
'get-size/get-size'
],
masonryDefinition );
} else {
Expand Down

0 comments on commit b830853

Please sign in to comment.