middleman-sculptor 0.23 → 0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +242 -0
- data/bin/middleman-sculptor +2 -1
- data/bin/sculpt +2 -1
- data/docs/styleguide-html.png +0 -0
- data/docs/styleguide-index.png +0 -0
- data/docs/styleguide-model.png +0 -0
- data/docs/styleguide-outline.png +0 -0
- data/docs/styleguide-page.png +0 -0
- data/lib/middleman-sculptor.rb +0 -6
- data/lib/middleman-sculptor/cli.rb +23 -50
- data/lib/middleman-sculptor/template.rb +5 -7
- data/lib/middleman-sculptor/template/.gitignore +3 -1
- data/lib/middleman-sculptor/template/Gemfile.tt +4 -3
- data/lib/middleman-sculptor/template/Procfile +2 -0
- data/lib/middleman-sculptor/template/config.tt +3 -34
- data/lib/middleman-sculptor/template/package.json +15 -0
- data/lib/middleman-sculptor/template/source/assets/{styles/app.scss → scripts/main.js} +0 -0
- data/lib/middleman-sculptor/template/source/assets/styles/main.scss +0 -0
- data/lib/middleman-sculptor/template/source/{assets/scripts/glyptotheque/directives.js → glyptotheque/app.js} +12 -3
- data/lib/middleman-sculptor/template/source/{assets/styles/glyptotheque → glyptotheque/styles}/_$variables.scss +0 -0
- data/lib/middleman-sculptor/template/source/{assets/styles/glyptotheque → glyptotheque/styles}/_base.scss +4 -1
- data/lib/middleman-sculptor/template/source/{assets/styles/glyptotheque → glyptotheque/styles}/_codehilite.scss +0 -0
- data/lib/middleman-sculptor/template/source/{assets/styles/glyptotheque → glyptotheque/styles}/_html-outline.scss +0 -0
- data/lib/middleman-sculptor/template/source/{assets/styles/glyptotheque → glyptotheque/styles}/_model-utils.scss +0 -0
- data/lib/middleman-sculptor/template/source/{assets/styles/glyptotheque → glyptotheque/styles}/_model.scss +1 -1
- data/lib/middleman-sculptor/template/source/{assets/styles/glyptotheque → glyptotheque/styles}/_nav.scss +0 -0
- data/lib/middleman-sculptor/template/source/glyptotheque/styles/main.scss +10 -0
- data/lib/middleman-sculptor/template/source/{assets → glyptotheque}/styles/pygments/borland.css +0 -0
- data/lib/middleman-sculptor/template/source/{assets → glyptotheque}/styles/pygments/colorful.css +0 -0
- data/lib/middleman-sculptor/template/source/{assets → glyptotheque}/styles/pygments/github.css +0 -0
- data/lib/middleman-sculptor/template/source/{assets → glyptotheque}/styles/pygments/trac.css +0 -0
- data/lib/middleman-sculptor/template/source/layouts/glyptotheque.slim +2 -1
- data/lib/middleman-sculptor/template/source/layouts/isolated.slim +1 -1
- data/lib/middleman-sculptor/template/source/layouts/layout.slim +1 -3
- data/lib/middleman-sculptor/template/webpack.config.js +33 -0
- data/lib/middleman-sculptor/version.rb +1 -1
- data/middleman-sculptor.gemspec +2 -2
- metadata +28 -28
- data/lib/middleman-sculptor/cli/init.rb +0 -15
- data/lib/middleman-sculptor/cli/version.rb +0 -12
- data/lib/middleman-sculptor/template/.bowerrc +0 -3
- data/lib/middleman-sculptor/template/bower.json +0 -12
- data/lib/middleman-sculptor/template/source/assets/scripts/app.js +0 -6
- data/lib/middleman-sculptor/template/source/assets/scripts/glyptotheque.js +0 -8
- data/lib/middleman-sculptor/template/source/assets/scripts/glyptotheque/controllers.js +0 -1
- data/lib/middleman-sculptor/template/source/assets/scripts/glyptotheque/services.js +0 -1
- data/lib/middleman-sculptor/template/source/assets/scripts/head-js.js +0 -1
- data/lib/middleman-sculptor/template/source/assets/scripts/iframe-js.js +0 -1
- data/lib/middleman-sculptor/template/source/assets/styles/glyptotheque.scss +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45fd0f603841d316da9f2340d714617d8abbaa27
|
4
|
+
data.tar.gz: aafd2681e9302073fd7f8c5d3b1f0c9ecc3fc4e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8525b97bce54f935809577f2c6a2098a5b2d0d0e6b4e330cc03246d967e48d840e6a0d74f663ffe730db1f1095387bf255ed640eeb9fedc39084a36e2e934034
|
7
|
+
data.tar.gz: c072b875290dbc23615a059468befe18ad45fb42697e3c598aed3916b18b521bd75bf8df57df58f8e9cee37fd05be238773e83368800219445b5e91d7affcf7a
|
data/README.md
ADDED
@@ -0,0 +1,242 @@
|
|
1
|
+
# Middleman Sculptor
|
2
|
+
|
3
|
+
[Middleman](https://middlemanapp.com/) extension for creation of interactive styleguides and code examples.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install middleman-sculptor
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
Middleman Sculptor has an excecutable `middleman-sculptor`. It is also aliased to `sculpt`.
|
12
|
+
|
13
|
+
To see the list of available commands run `sculpt help`. Sculptor extends [Middleman](https://github.com/middleman/middleman) so all Middleman commands also apply, although they currently do not appear under the `sculptor help` command.
|
14
|
+
|
15
|
+
### New project
|
16
|
+
|
17
|
+
To start a new project:
|
18
|
+
|
19
|
+
$ middleman-sculptor init project-name
|
20
|
+
|
21
|
+
This will create a new directory `project-name` with templates for a new styleguide. It also installs Ruby and NPM dependencies.
|
22
|
+
|
23
|
+
Aliases: `i` and `n`.
|
24
|
+
|
25
|
+
### Configuring external Sass load paths and assets
|
26
|
+
|
27
|
+
Middleman Sculptor uses [Webpack](https://webpack.github.io/) to bundle up its JavaScript. This allows writing JS in CommonJS or AMD style. Then JS is passed to Asset Pipiline to be served.
|
28
|
+
|
29
|
+
To use an NPM JS Library just `npm install` it and Webpack will pick it up. To use Sass library or make images discoverable by Asset Pipeline (e.g. [Mojular GOV.UK Elements](https://github.com/mojular/govuk-elements)) add relevant paths to `Sass.load_paths` and Sprockets in `config.rb`:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
# Sass load paths
|
33
|
+
govuk_elements_path = File.join(root, 'node_modules/mojular-govuk-elements')
|
34
|
+
JSON.parse(IO.read("#{govuk_elements_path}/package.json"))['paths']['sass'].each do |p|
|
35
|
+
Sass.load_paths << File.expand_path("#{govuk_elements_path}/#{p}")
|
36
|
+
end
|
37
|
+
|
38
|
+
# Sprockets
|
39
|
+
ready do
|
40
|
+
moj_images = File.join(root, 'node_modules', 'mojular-govuk-elements', 'assets', 'images')
|
41
|
+
sprockets.append_path moj_images
|
42
|
+
|
43
|
+
Dir.chdir(moj_images) do
|
44
|
+
Dir['**/*.{js,png,jpg}'].each do |asset|
|
45
|
+
sprockets.import_asset(asset)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
```
|
50
|
+
|
51
|
+
#### Project structure
|
52
|
+
|
53
|
+
When Sculptor generates a new project it adds a few files and directories that are used for the styleguide UI. They are called or prefixed with the word *glyptotheque* and can be edited to customise the look and feel of the styleguide.
|
54
|
+
|
55
|
+
### Existing project
|
56
|
+
|
57
|
+
To update Sculptor in an existing project run `middleman-sculptor init` in the project folder. It's recommended to have the existing project in a version control system so that any conflicting local changes can be easily reapplied.
|
58
|
+
|
59
|
+
|
60
|
+
### Running local server
|
61
|
+
|
62
|
+
Bundle up JavaScript using Webpack:
|
63
|
+
|
64
|
+
$ node_modules/.bin/webpack
|
65
|
+
|
66
|
+
Or install it globally `npm install -g webpack` and run using `webpack` command. You can leave it running in another terminal tab `webpack --watch`.
|
67
|
+
|
68
|
+
During the development run local [Middleman server](https://middlemanapp.com/basics/development_cycle/):
|
69
|
+
|
70
|
+
$ middleman server
|
71
|
+
|
72
|
+
`server` is optional and is the default command so can be omitted.
|
73
|
+
|
74
|
+
*Recommended* way is to run both using [Foreman](https://github.com/ddollar/foreman) (included in Gemfile):
|
75
|
+
|
76
|
+
$ foreman start
|
77
|
+
|
78
|
+
This will launch Middleman server and Webpack watch together.
|
79
|
+
|
80
|
+
|
81
|
+
## Creating a styleguide
|
82
|
+
|
83
|
+
A styleguide is a collection of html snippets called **models**. Sculptor extends Middleman with several new helpers and templates that wrap these snippets.
|
84
|
+
|
85
|
+
Middleman supports a [number of templates](https://middlemanapp.com/basics/template_engine_options/) so any ERB, Haml or Slim should all work the same but it's mostly been tested with Slim.
|
86
|
+
|
87
|
+
To start, create a new page anywhere in `source` directory. It should have a [Frontmatter](https://middlemanapp.com/basics/frontmatter/) with at least one property `title`.
|
88
|
+
|
89
|
+
Let's say we create a new page `source/button.html.slim`
|
90
|
+
|
91
|
+
```slim
|
92
|
+
---
|
93
|
+
title: Button
|
94
|
+
---
|
95
|
+
|
96
|
+
= model
|
97
|
+
button Click me
|
98
|
+
```
|
99
|
+
|
100
|
+
Now if we run `middleman server` and go to http://localhost:4567/, we'll see a menu in the left-hand side sidebar with *Button* entry. There is also a box in the main section called *Button*. They both link to our new page.
|
101
|
+
|
102
|
+
<img src=docs/styleguide-index.png width=800>
|
103
|
+
|
104
|
+
The Button page shows the model, and toggles to show its source and structure outline.
|
105
|
+
|
106
|
+
<img src=docs/styleguide-page.png width=800>
|
107
|
+
|
108
|
+
Each additional model will appear on the page and can be mixed with any other HTML. For example, documentation on usage of a particular component.
|
109
|
+
|
110
|
+
NB: Due to the way Sculptor extracts models from template to make them accessible by URLs, some pages may require a server restart after they are added/renamed.
|
111
|
+
|
112
|
+
|
113
|
+
## Adding stylesheets
|
114
|
+
|
115
|
+
Sculptor uses Sass by default but other CSS preprocessors or vanilla CSS can be used.
|
116
|
+
|
117
|
+
Styles can be placed in the same directory as the HTML file, or in the `assets` directory. To ensure the styles properly integrate with the assets pipeline, it's recommended to place styles in the `assets/styles` directory or anywhere within the `source` directory as long as they are in subdirectory called `styles`. Then the Sass can correctly import other stylesheets (including external dependencies) and find images.
|
118
|
+
|
119
|
+
Let's create a new stylesheet for our button. Create a new file `source/styles/generic.scss` with the following contents:
|
120
|
+
|
121
|
+
```scss
|
122
|
+
button {
|
123
|
+
padding: 20px;
|
124
|
+
background: #ddd;
|
125
|
+
font-size: 1em;
|
126
|
+
border: 0;
|
127
|
+
}
|
128
|
+
```
|
129
|
+
|
130
|
+
To include this stylesheet in the file add the `stylesheet` property to file's Frontmatter:
|
131
|
+
|
132
|
+
```yaml
|
133
|
+
---
|
134
|
+
title: Button
|
135
|
+
stylesheet: styles/generic
|
136
|
+
---
|
137
|
+
```
|
138
|
+
|
139
|
+
The path is relative to the file's location. It can also include relative paths (e.g. `../another-directory/style.scss`). To use `source` directory as root start path with `/` (e.g. `/styles/generic.scss`).
|
140
|
+
|
141
|
+
The property can also be called `stylesheets` and include a list of files, either comma-separated or list separated, e.g.:
|
142
|
+
|
143
|
+
```yaml
|
144
|
+
stylesheets: base, form, footer
|
145
|
+
```
|
146
|
+
|
147
|
+
```yaml
|
148
|
+
stylesheets:
|
149
|
+
- base
|
150
|
+
- form
|
151
|
+
- footer
|
152
|
+
```
|
153
|
+
|
154
|
+
## Adding JavaScript
|
155
|
+
|
156
|
+
Similarly to styles, JS files can be injected.
|
157
|
+
|
158
|
+
```yaml
|
159
|
+
javascript: js/button.js
|
160
|
+
```
|
161
|
+
|
162
|
+
## Models
|
163
|
+
|
164
|
+
Each page can contain any number of *models*, the extracts of HTML that are rendered on HTML page several treatments:
|
165
|
+
|
166
|
+
- The snippet is rendered on HTML page in a special container
|
167
|
+
<img src=docs/styleguide-model.png width=400>
|
168
|
+
|
169
|
+
- It has an **Outline** toggle that shows the structure of the HTML snippet
|
170
|
+
<img src=docs/styleguide-outline.png width=400>
|
171
|
+
|
172
|
+
- It has an **HTML Source** toggle that shows the HTML snippet code
|
173
|
+
<img src=docs/styleguide-html.png width=400>
|
174
|
+
|
175
|
+
There are two types of models: **inline** and **iframe**.
|
176
|
+
|
177
|
+
### Inline models
|
178
|
+
|
179
|
+
Good for rendering isolated components which styles are scoped in components selector and don't affect the rest of the page.
|
180
|
+
|
181
|
+
This is a standard model helper. It renders its contents and styles directly in the page.
|
182
|
+
|
183
|
+
[Slim Template Language](https://github.com/slim-template/slim) also parses standard HTML which makes it great for quickly generating pages. Although currently Slim minifies rendered HTML. Slim also allows [embedding of other languages](https://github.com/slim-template/slim#embedded-engines-markdown-). I recommend embedding your code in `erb:`
|
184
|
+
|
185
|
+
```slim
|
186
|
+
= model
|
187
|
+
erb:
|
188
|
+
<h1 class="page-title">Sculptor</h1>
|
189
|
+
```
|
190
|
+
|
191
|
+
This way the white spaces are preserved.
|
192
|
+
|
193
|
+
### iframe models
|
194
|
+
|
195
|
+
When the embedded styles or JS need to be encapsulated, use iframe model. It will render its contents in the iframe and resize appropriately.
|
196
|
+
|
197
|
+
The first parameter is required and used to generate a file for each model which is used as iframe source.
|
198
|
+
|
199
|
+
This model also adds an **isolate** button which links to those individual files, allowing you to view each component on its own without any of Sculptor's UI.
|
200
|
+
|
201
|
+
```slim
|
202
|
+
= model 'title',
|
203
|
+
iframe: true
|
204
|
+
erb:
|
205
|
+
<h1 class="page-title">Sculptor</h1>
|
206
|
+
```
|
207
|
+
|
208
|
+
Or using an alias:
|
209
|
+
|
210
|
+
```slim
|
211
|
+
= imodel 'title'
|
212
|
+
erb:
|
213
|
+
<h1 class="page-title">Sculptor</h1>
|
214
|
+
```
|
215
|
+
|
216
|
+
### Remote grab
|
217
|
+
|
218
|
+
Model can also have a remote source.
|
219
|
+
|
220
|
+
```slim
|
221
|
+
= imodel 'bbc',
|
222
|
+
url: 'http://www.bbc.co.uk/',
|
223
|
+
css: '#h4weather'
|
224
|
+
```
|
225
|
+
|
226
|
+
- `url` points to any public webpage (JS is not loaded)
|
227
|
+
- `css` grabs only the specified CSS selector. If multiple elements match, they are all returned. To pick a specific element within multiple returned, select it by the 0-index (separate selector from index by at least 1 space): `css: 'h2 #2'`
|
228
|
+
|
229
|
+
It's also possible to include remote CSS and JS.
|
230
|
+
|
231
|
+
```yaml
|
232
|
+
---
|
233
|
+
stylesheet: http://static.bbci.co.uk/h4weather/0.82.2/style/h4weather.css
|
234
|
+
javascript: http://code.jquery.com/jquery-2.1.4.min.js
|
235
|
+
---
|
236
|
+
```
|
237
|
+
|
238
|
+
---
|
239
|
+
|
240
|
+
### Examples
|
241
|
+
|
242
|
+
- [Playground for GOV.UK elements](http://ministryofjustice.github.io/bower-playground/)
|
data/bin/middleman-sculptor
CHANGED
data/bin/sculpt
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/middleman-sculptor.rb
CHANGED
@@ -4,12 +4,6 @@ require 'middleman-sculptor/cli'
|
|
4
4
|
require 'middleman-sculptor/resource_patch'
|
5
5
|
require 'middleman-sculptor/sprockets_patch'
|
6
6
|
|
7
|
-
begin
|
8
|
-
require "middleman-sculptor/template"
|
9
|
-
rescue LoadError
|
10
|
-
# v4
|
11
|
-
end
|
12
|
-
|
13
7
|
::Middleman::Extensions.register(:sculptor) do
|
14
8
|
require 'middleman-sculptor/extension'
|
15
9
|
::Middleman::SculptorExtension
|
@@ -1,56 +1,29 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
require 'middleman-sculptor/
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
def self.add_middleman_task(klass)
|
15
|
-
klass.namespace "sculptor_#{klass.namespace}"
|
16
|
-
@@middleman_classes << klass
|
17
|
-
end
|
18
|
-
|
19
|
-
add_middleman_task Middleman::Cli::Init
|
20
|
-
# add_middleman_task Middleman::Cli::Server
|
1
|
+
require 'thor'
|
2
|
+
require 'middleman-core/version'
|
3
|
+
require 'middleman-sculptor/version'
|
4
|
+
begin
|
5
|
+
# v4
|
6
|
+
require 'middleman-cli'
|
7
|
+
$template_name = 'tyom/middleman-templates-sculptor#wip'
|
8
|
+
rescue LoadError
|
9
|
+
require 'middleman-core/cli'
|
10
|
+
require 'middleman-sculptor/template'
|
11
|
+
$template_name = :sculptor
|
12
|
+
end
|
21
13
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
classes = @@middleman_classes + sculptor_classes
|
30
|
-
classes.each do |thor_class|
|
31
|
-
list += thor_class.printable_tasks(false)
|
14
|
+
module Middleman
|
15
|
+
module Sculptor
|
16
|
+
module Cli
|
17
|
+
class Base < Thor
|
18
|
+
desc 'version', 'Show version'
|
19
|
+
def version
|
20
|
+
say "Sculptor #{Middleman::Sculptor::VERSION} (Middleman #{Middleman::VERSION})"
|
32
21
|
end
|
33
|
-
list.sort! { |a, b| a[0] <=> b[0] }
|
34
|
-
|
35
|
-
shell.say 'Tasks:'
|
36
|
-
shell.print_table(list, indent: 2, truncate: true)
|
37
|
-
shell.say
|
38
|
-
end
|
39
|
-
end
|
40
22
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
meth = self.class.map[meth] if self.class.map.key?(meth)
|
46
|
-
|
47
|
-
klass, task = Thor::Util.find_class_and_task_by_namespace("sculptor_#{meth}:#{meth}")
|
48
|
-
|
49
|
-
if klass.nil?
|
50
|
-
raise Thor::Error, "Command '#{meth}' not found. Try 'middleman-sculptor help' for a list of commands."
|
51
|
-
else
|
52
|
-
args.unshift(task) if task
|
53
|
-
klass.start(args, shell: shell)
|
23
|
+
desc 'init', 'Initialize new Sculptor project'
|
24
|
+
def init(target='.')
|
25
|
+
invoke ::Middleman::Cli::Init, [:init, target], template: $template_name
|
26
|
+
end
|
54
27
|
end
|
55
28
|
end
|
56
29
|
end
|
@@ -19,18 +19,16 @@ module Middleman
|
|
19
19
|
template 'config.tt', File.join(location, 'config.rb')
|
20
20
|
copy_file '.gitignore', File.join(location, '.gitignore')
|
21
21
|
copy_file '.editorconfig', File.join(location, '.editorconfig')
|
22
|
-
copy_file '
|
23
|
-
copy_file '
|
22
|
+
copy_file 'Procfile', File.join(location, 'Procfile')
|
23
|
+
copy_file 'package.json', File.join(location, 'package.json')
|
24
|
+
copy_file 'webpack.config.js', File.join(location, 'webpack.config.js')
|
24
25
|
|
25
26
|
directory 'source', File.join(location, 'source')
|
26
27
|
directory 'data', File.join(location, 'data')
|
27
28
|
end
|
28
29
|
|
29
|
-
def
|
30
|
-
#
|
31
|
-
run("command -v bower >/dev/null 2>&1 || npm install -g bower")
|
32
|
-
# Install dependencies
|
33
|
-
run("cd #{location}; bower install")
|
30
|
+
def run_npm
|
31
|
+
run("cd #{location}; npm install")
|
34
32
|
end
|
35
33
|
end
|
36
34
|
end
|
@@ -1,12 +1,13 @@
|
|
1
1
|
# If you have OpenSSL installed, we recommend updating
|
2
2
|
# the following line to use "https"
|
3
|
-
source '
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
gem 'middleman', '~> <%= Middleman::VERSION %>'
|
6
6
|
gem 'middleman-sculptor', '~> <%= Middleman::Sculptor::VERSION %>'
|
7
|
-
gem 'middleman-livereload'
|
8
|
-
gem 'middleman-deploy'
|
7
|
+
gem 'middleman-livereload'
|
8
|
+
gem 'middleman-deploy'
|
9
9
|
gem 'middleman-autoprefixer'
|
10
10
|
gem 'middleman-syntax'
|
11
11
|
gem 'bourbon'
|
12
12
|
gem 'breakpoint'
|
13
|
+
gem 'foreman'
|
@@ -65,43 +65,12 @@ activate :autoprefixer
|
|
65
65
|
# helpers do
|
66
66
|
# end
|
67
67
|
|
68
|
-
|
69
|
-
set :
|
70
|
-
|
71
|
-
# Change the CSS directory
|
72
|
-
# set :css_dir, "alternative_css_directory"
|
73
|
-
<% end -%>
|
74
|
-
<% if options[:js_dir] -%>
|
75
|
-
set :js_dir, '<%= options[:js_dir] -%>'
|
76
|
-
<% else -%>
|
77
|
-
# Change the JS directory
|
78
|
-
# set :js_dir, "alternative_js_directory"
|
79
|
-
<% end -%>
|
80
|
-
<% if options[:images_dir] -%>
|
81
|
-
set :images_dir, '<%= options[:images_dir] -%>'
|
82
|
-
<% else -%>
|
83
|
-
# Change the images directory
|
84
|
-
# set :images_dir, "alternative_image_directory"
|
85
|
-
<% end -%>
|
68
|
+
set :css_dir, 'assets/styles'
|
69
|
+
set :js_dir, 'assets/scripts'
|
70
|
+
set :images_dir, 'assets/images'
|
86
71
|
|
87
72
|
set :relative_links, true
|
88
73
|
|
89
|
-
bowerrc_dir = JSON.parse(IO.read("#{root}/.bowerrc"))['directory']
|
90
|
-
|
91
|
-
# Compass configuration
|
92
|
-
compass_config do |config|
|
93
|
-
config.sass_options = {
|
94
|
-
quiet: true
|
95
|
-
}
|
96
|
-
# For Style Guide CSS sources
|
97
|
-
# config.output_style = :expanded
|
98
|
-
end
|
99
|
-
|
100
|
-
# Sprockets
|
101
|
-
ready do
|
102
|
-
sprockets.append_path(File.join(root, bowerrc_dir))
|
103
|
-
end
|
104
|
-
|
105
74
|
Slim::Engine.disable_option_validator!
|
106
75
|
Slim::Engine.set_options pretty: true
|
107
76
|
Slim::Engine.set_options attr_list_delims: { '(' => ')', '[' => ']' }
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"name": "glyptotheque",
|
3
|
+
"private": true,
|
4
|
+
"dependencies": {
|
5
|
+
"angular": "^1.4.7",
|
6
|
+
"iframe-resizer": "^3.4.2",
|
7
|
+
"lodash": "^3.10.1",
|
8
|
+
"mousetrap": "^1.5.3",
|
9
|
+
"store": "^1.3.17"
|
10
|
+
},
|
11
|
+
"devDependencies": {
|
12
|
+
"expose-loader": "^0.7.0",
|
13
|
+
"webpack": "^1.12.2"
|
14
|
+
}
|
15
|
+
}
|
File without changes
|
File without changes
|
@@ -1,4 +1,8 @@
|
|
1
|
-
angular
|
1
|
+
var angular = require('angular');
|
2
|
+
var Mousetrap = require('mousetrap');
|
3
|
+
var iFrameResize = require('iframe-resizer').iframeResizer;
|
4
|
+
|
5
|
+
angular.module('glyptotheque', [])
|
2
6
|
|
3
7
|
.directive('glyptoModel', function($compile, $http, $templateCache) {
|
4
8
|
return {
|
@@ -116,12 +120,17 @@ angular.module('directives', [])
|
|
116
120
|
|
117
121
|
$scope.$watch('navIsHidden', function() {
|
118
122
|
if(iframe.contentWindow.parentIFrame) {
|
119
|
-
//
|
123
|
+
// compensate for nav transition
|
120
124
|
setTimeout(function() {
|
121
125
|
iframe.contentWindow.parentIFrame.size();
|
122
|
-
}, 400)
|
126
|
+
}, 400);
|
123
127
|
}
|
124
128
|
});
|
125
129
|
}
|
126
130
|
};
|
127
131
|
});
|
132
|
+
|
133
|
+
iFrameResize({
|
134
|
+
enablePublicMethods: true,
|
135
|
+
heightCalculationMethod: 'lowestElement'
|
136
|
+
});
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/middleman-sculptor/template/source/{assets → glyptotheque}/styles/pygments/borland.css
RENAMED
File without changes
|
data/lib/middleman-sculptor/template/source/{assets → glyptotheque}/styles/pygments/colorful.css
RENAMED
File without changes
|
data/lib/middleman-sculptor/template/source/{assets → glyptotheque}/styles/pygments/github.css
RENAMED
File without changes
|
data/lib/middleman-sculptor/template/source/{assets → glyptotheque}/styles/pygments/trac.css
RENAMED
File without changes
|
@@ -1,7 +1,8 @@
|
|
1
1
|
- content_for :page_title, page_title
|
2
2
|
- content_for :ng_app, 'glyptotheque'
|
3
|
-
- content_for :stylesheets, stylesheet_link_tag('glyptotheque')
|
3
|
+
- content_for :stylesheets, stylesheet_link_tag('/glyptotheque/styles/main')
|
4
4
|
- content_for :body_class, "section-#{get_section_of_resource(current_page).slug}"
|
5
|
+
- content_for :javascripts, javascript_include_tag('glyptotheque/scripts/glyptotheque.bundle')
|
5
6
|
|
6
7
|
= wrap_layout :layout do
|
7
8
|
- if resource_tree('/').any?
|
@@ -19,7 +19,7 @@ html
|
|
19
19
|
body class="#{yield_content(:body_class)}"
|
20
20
|
= current_model.html
|
21
21
|
|
22
|
-
= javascript_include_tag 'iframe-
|
22
|
+
= javascript_include_tag 'glyptotheque/scripts/iframe-content-window.bundle'
|
23
23
|
= yield_content :javascripts
|
24
24
|
- if current_resource.metadata.options.iframe
|
25
25
|
= include_javascripts(current_model[:javascript] || current_page.data.javascripts || current_page.data.javascript)
|
@@ -5,13 +5,11 @@ html ng-app=(yield_content(:ng_app))
|
|
5
5
|
title = yield_content :page_title
|
6
6
|
meta name='viewport' content='width=device-width'
|
7
7
|
= stylesheet_link_tag '//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css'
|
8
|
-
- content_for :stylesheets, stylesheet_link_tag('app')
|
9
8
|
= yield_content :stylesheets
|
10
|
-
= javascript_include_tag '
|
9
|
+
= javascript_include_tag 'glyptotheque/scripts/store.bundle'
|
11
10
|
|
12
11
|
body class="#{yield_content(:body_class)}"
|
13
12
|
= yield
|
14
13
|
|
15
14
|
= yield_content :javascripts
|
16
|
-
= javascript_include_tag 'app'
|
17
15
|
= yield_content :post_body
|
@@ -0,0 +1,33 @@
|
|
1
|
+
var webpack = require("webpack");
|
2
|
+
|
3
|
+
module.exports = {
|
4
|
+
entry: {
|
5
|
+
'iframe-content-window': 'iframeContentWindow',
|
6
|
+
glyptotheque: './source/glyptotheque/app.js',
|
7
|
+
main: './source/assets/scripts/main.js',
|
8
|
+
store: 'store',
|
9
|
+
},
|
10
|
+
output: {
|
11
|
+
path: './source/glyptotheque/scripts',
|
12
|
+
filename: '[name].bundle.js'
|
13
|
+
},
|
14
|
+
module: {
|
15
|
+
loaders: [
|
16
|
+
{ include: /\.json$/, loaders: ['json-loader'] },
|
17
|
+
{ include: /store\.js$/, loader: 'expose?store' }
|
18
|
+
]
|
19
|
+
},
|
20
|
+
resolve: {
|
21
|
+
alias: {
|
22
|
+
'iframeContentWindow': './node_modules/iframe-resizer/js/iframeResizer.contentWindow.min.js'
|
23
|
+
},
|
24
|
+
modulesDirectories: [
|
25
|
+
'node_modules',
|
26
|
+
'node_modules/mojular/node_modules'
|
27
|
+
],
|
28
|
+
extensions: ['', '.json', '.js']
|
29
|
+
},
|
30
|
+
plugins: [
|
31
|
+
new webpack.optimize.DedupePlugin()
|
32
|
+
]
|
33
|
+
};
|
data/middleman-sculptor.gemspec
CHANGED
@@ -20,10 +20,10 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.require_paths = ['lib']
|
21
21
|
s.required_ruby_version = '>= 1.9.3'
|
22
22
|
|
23
|
-
s.add_dependency 'middleman-core', '~> 3.
|
23
|
+
s.add_dependency 'middleman-core', '~> 3.4'
|
24
24
|
s.add_dependency 'middleman-sprockets', '~> 3.4'
|
25
25
|
s.add_dependency 'rest-client', '>= 1.7.3'
|
26
|
-
s.add_dependency
|
26
|
+
s.add_dependency 'nokogiri', ['>= 1.6', '< 2.0']
|
27
27
|
s.add_dependency 'oj', '~> 2.10.2'
|
28
28
|
s.add_dependency 'slim', '>= 3.0'
|
29
29
|
s.add_dependency 'pry'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-sculptor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.24'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyom Semonov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: middleman-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '3.
|
26
|
+
version: '3.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: middleman-sprockets
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,13 +127,17 @@ files:
|
|
127
127
|
- ".gitignore"
|
128
128
|
- Gemfile
|
129
129
|
- LICENCE.md
|
130
|
+
- README.md
|
130
131
|
- Rakefile
|
131
132
|
- bin/middleman-sculptor
|
132
133
|
- bin/sculpt
|
134
|
+
- docs/styleguide-html.png
|
135
|
+
- docs/styleguide-index.png
|
136
|
+
- docs/styleguide-model.png
|
137
|
+
- docs/styleguide-outline.png
|
138
|
+
- docs/styleguide-page.png
|
133
139
|
- lib/middleman-sculptor.rb
|
134
140
|
- lib/middleman-sculptor/cli.rb
|
135
|
-
- lib/middleman-sculptor/cli/init.rb
|
136
|
-
- lib/middleman-sculptor/cli/version.rb
|
137
141
|
- lib/middleman-sculptor/extension.rb
|
138
142
|
- lib/middleman-sculptor/hash_dot_syntax.rb
|
139
143
|
- lib/middleman-sculptor/helpers/model.rb
|
@@ -142,45 +146,41 @@ files:
|
|
142
146
|
- lib/middleman-sculptor/resource_patch.rb
|
143
147
|
- lib/middleman-sculptor/sprockets_patch.rb
|
144
148
|
- lib/middleman-sculptor/template.rb
|
145
|
-
- lib/middleman-sculptor/template/.bowerrc
|
146
149
|
- lib/middleman-sculptor/template/.editorconfig
|
147
150
|
- lib/middleman-sculptor/template/.gitignore
|
148
151
|
- lib/middleman-sculptor/template/Gemfile.tt
|
149
|
-
- lib/middleman-sculptor/template/
|
152
|
+
- lib/middleman-sculptor/template/Procfile
|
150
153
|
- lib/middleman-sculptor/template/config.tt
|
151
154
|
- lib/middleman-sculptor/template/data/.gitkeep
|
155
|
+
- lib/middleman-sculptor/template/package.json
|
152
156
|
- lib/middleman-sculptor/template/source/assets/images/.gitkeep
|
153
|
-
- lib/middleman-sculptor/template/source/assets/scripts/
|
154
|
-
- lib/middleman-sculptor/template/source/assets/
|
155
|
-
- lib/middleman-sculptor/template/source/assets/scripts/glyptotheque/controllers.js
|
156
|
-
- lib/middleman-sculptor/template/source/assets/scripts/glyptotheque/directives.js
|
157
|
-
- lib/middleman-sculptor/template/source/assets/scripts/glyptotheque/services.js
|
158
|
-
- lib/middleman-sculptor/template/source/assets/scripts/head-js.js
|
159
|
-
- lib/middleman-sculptor/template/source/assets/scripts/iframe-js.js
|
160
|
-
- lib/middleman-sculptor/template/source/assets/styles/app.scss
|
161
|
-
- lib/middleman-sculptor/template/source/assets/styles/glyptotheque.scss
|
162
|
-
- lib/middleman-sculptor/template/source/assets/styles/glyptotheque/_$variables.scss
|
163
|
-
- lib/middleman-sculptor/template/source/assets/styles/glyptotheque/_base.scss
|
164
|
-
- lib/middleman-sculptor/template/source/assets/styles/glyptotheque/_codehilite.scss
|
165
|
-
- lib/middleman-sculptor/template/source/assets/styles/glyptotheque/_html-outline.scss
|
166
|
-
- lib/middleman-sculptor/template/source/assets/styles/glyptotheque/_model-utils.scss
|
167
|
-
- lib/middleman-sculptor/template/source/assets/styles/glyptotheque/_model.scss
|
168
|
-
- lib/middleman-sculptor/template/source/assets/styles/glyptotheque/_nav.scss
|
169
|
-
- lib/middleman-sculptor/template/source/assets/styles/pygments/borland.css
|
170
|
-
- lib/middleman-sculptor/template/source/assets/styles/pygments/colorful.css
|
171
|
-
- lib/middleman-sculptor/template/source/assets/styles/pygments/github.css
|
172
|
-
- lib/middleman-sculptor/template/source/assets/styles/pygments/trac.css
|
157
|
+
- lib/middleman-sculptor/template/source/assets/scripts/main.js
|
158
|
+
- lib/middleman-sculptor/template/source/assets/styles/main.scss
|
173
159
|
- lib/middleman-sculptor/template/source/glyptotheque/_model-outline-element.slim
|
174
160
|
- lib/middleman-sculptor/template/source/glyptotheque/_model-outline.slim
|
175
161
|
- lib/middleman-sculptor/template/source/glyptotheque/_model-utils.slim
|
176
162
|
- lib/middleman-sculptor/template/source/glyptotheque/_model.slim
|
177
163
|
- lib/middleman-sculptor/template/source/glyptotheque/_nav.slim
|
164
|
+
- lib/middleman-sculptor/template/source/glyptotheque/app.js
|
178
165
|
- lib/middleman-sculptor/template/source/glyptotheque/directory-index.html.slim
|
179
166
|
- lib/middleman-sculptor/template/source/glyptotheque/site-index.html.slim
|
180
167
|
- lib/middleman-sculptor/template/source/glyptotheque/sitemap.json.erb
|
168
|
+
- lib/middleman-sculptor/template/source/glyptotheque/styles/_$variables.scss
|
169
|
+
- lib/middleman-sculptor/template/source/glyptotheque/styles/_base.scss
|
170
|
+
- lib/middleman-sculptor/template/source/glyptotheque/styles/_codehilite.scss
|
171
|
+
- lib/middleman-sculptor/template/source/glyptotheque/styles/_html-outline.scss
|
172
|
+
- lib/middleman-sculptor/template/source/glyptotheque/styles/_model-utils.scss
|
173
|
+
- lib/middleman-sculptor/template/source/glyptotheque/styles/_model.scss
|
174
|
+
- lib/middleman-sculptor/template/source/glyptotheque/styles/_nav.scss
|
175
|
+
- lib/middleman-sculptor/template/source/glyptotheque/styles/main.scss
|
176
|
+
- lib/middleman-sculptor/template/source/glyptotheque/styles/pygments/borland.css
|
177
|
+
- lib/middleman-sculptor/template/source/glyptotheque/styles/pygments/colorful.css
|
178
|
+
- lib/middleman-sculptor/template/source/glyptotheque/styles/pygments/github.css
|
179
|
+
- lib/middleman-sculptor/template/source/glyptotheque/styles/pygments/trac.css
|
181
180
|
- lib/middleman-sculptor/template/source/layouts/glyptotheque.slim
|
182
181
|
- lib/middleman-sculptor/template/source/layouts/isolated.slim
|
183
182
|
- lib/middleman-sculptor/template/source/layouts/layout.slim
|
183
|
+
- lib/middleman-sculptor/template/webpack.config.js
|
184
184
|
- lib/middleman-sculptor/version.rb
|
185
185
|
- lib/middleman_extension.rb
|
186
186
|
- middleman-sculptor.gemspec
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'middleman-core/cli'
|
2
|
-
|
3
|
-
module Middleman::Cli
|
4
|
-
class Init < Thor
|
5
|
-
def init(name='.')
|
6
|
-
key = :sculptor
|
7
|
-
unless ::Middleman::Templates.registered.key?(key)
|
8
|
-
raise Thor::Error, "Unknown project template '#{key}'"
|
9
|
-
end
|
10
|
-
|
11
|
-
thor_group = ::Middleman::Templates.registered[key]
|
12
|
-
thor_group.new([name], options).invoke_all
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'middleman-sculptor/version'
|
2
|
-
|
3
|
-
module Middleman::Sculptor::Cli
|
4
|
-
class Version < Thor
|
5
|
-
namespace :sculptor_version
|
6
|
-
|
7
|
-
desc 'version', 'Show version'
|
8
|
-
def version
|
9
|
-
say "Sculptor #{Middleman::Sculptor::VERSION} (Middleman #{Middleman::VERSION})"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
angular.module('controllers', []);
|
@@ -1 +0,0 @@
|
|
1
|
-
angular.module('services', []);
|
@@ -1 +0,0 @@
|
|
1
|
-
//= require store
|
@@ -1 +0,0 @@
|
|
1
|
-
//= require iframe-resizer/js/iframeResizer.contentWindow.min
|
@@ -1,10 +0,0 @@
|
|
1
|
-
@import 'bourbon';
|
2
|
-
@import 'breakpoint';
|
3
|
-
|
4
|
-
@import 'glyptotheque/$variables';
|
5
|
-
@import 'glyptotheque/base';
|
6
|
-
@import 'glyptotheque/nav';
|
7
|
-
@import 'glyptotheque/model';
|
8
|
-
@import 'glyptotheque/model-utils';
|
9
|
-
@import 'glyptotheque/html-outline';
|
10
|
-
@import 'glyptotheque/codehilite';
|