middleman-jspm 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +10 -4
- data/lib/middleman-jspm/commands.rb +7 -1
- data/lib/middleman-jspm/version.rb +1 -1
- data/middleman-jspm.gemspec +3 -3
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72a8deb5a96e0a014ddc6d683beb7034d8e18342
|
4
|
+
data.tar.gz: 33ea3dc2c42e90132f39dcfbcd22af42970c1ebf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be7756ffd791e244f1989b090671680c449b44053cc8699618674d12c61a064a1eedda9ce2f9d6af7fe85d2e629bc835e326fda1216d9a330661554dd83590a8
|
7
|
+
data.tar.gz: 3d5cdb25a566158d8ac7cbf732df485e867feb74fa99a4492a888b5ef2cf37925b39229f69126a605a395a560c6d971e3d36e58561e07b0e09ee5f99085e9106
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/README.md
CHANGED
@@ -11,10 +11,12 @@ gem install middleman
|
|
11
11
|
middleman init PROJECT
|
12
12
|
```
|
13
13
|
|
14
|
-
Once that's done, add `gem "middleman-jspm"
|
14
|
+
Once that's done, add `gem "middleman-jspm"` to your `Gemfile` and run `bundle update`
|
15
15
|
|
16
16
|
## Configuring
|
17
17
|
|
18
|
+
Add the following somehere in your `config.rb`:
|
19
|
+
|
18
20
|
```ruby
|
19
21
|
activate :jspm
|
20
22
|
```
|
@@ -37,7 +39,7 @@ After you have installed node, run:
|
|
37
39
|
|
38
40
|
```
|
39
41
|
npm install jspm
|
40
|
-
middleman jspm
|
42
|
+
middleman jspm install
|
41
43
|
```
|
42
44
|
|
43
45
|
JSPM will ask if you want it to configure `config.js`. Say yes.
|
@@ -67,6 +69,10 @@ You can now install packages by running `middleman jspm install <packagename>` a
|
|
67
69
|
|
68
70
|
The above `modules.json` file will build a module named `main` that, in addition to dependencies defined in the file, will include jQuery but will not include React. The module will also compile as self-executing (which means JSPM will not add `system.js` and `config.js`) to the resulting file.
|
69
71
|
|
72
|
+
## Installing JSPM Packages
|
73
|
+
|
74
|
+
You can use `middleman jspm` to run JSPM commands, install packages, and build bundles. For more information, see the [JSPM-CLI documentation](https://github.com/jspm/jspm-cli).
|
75
|
+
|
70
76
|
## Building JSPM Pages
|
71
77
|
|
72
78
|
This is a minimal working example, that includes the module in `main.js` and all of it's dependencies:
|
@@ -82,7 +88,7 @@ This is a minimal working example, that includes the module in `main.js` and all
|
|
82
88
|
<%= jspm_include_environment %>
|
83
89
|
</head>
|
84
90
|
<body>
|
85
|
-
<div id="app"
|
91
|
+
<div id="app"></div>
|
86
92
|
<%= jspm_include_module("main") %>
|
87
93
|
</body>
|
88
94
|
</html>
|
@@ -91,7 +97,7 @@ This is a minimal working example, that includes the module in `main.js` and all
|
|
91
97
|
`jspm_include_environment` includes the SystemJS and configuration files needed by JSPM and will include the correct files for both build and development environments. If all modules defined in `modules.json` are self-executing, this command returns nothing.
|
92
98
|
|
93
99
|
`jspm_include_module(<name>)` includes a module into the present document and will include the correct files, in the correct manner, for both build and development environments.
|
94
|
-
|
100
|
+
|
95
101
|
## Other Helpers
|
96
102
|
|
97
103
|
Finally, there is also a helper called `jspm_path(<name>, [<source>])` that can give you the path of a file installed with JSPM. For instance, to look the path of jquery that was installed from github, you would use `jspm_path("components/jquery", "github")` to get the path of the jquery used by JSPM. The helper works the same way for NPM packages.
|
@@ -35,9 +35,15 @@ module Middleman
|
|
35
35
|
raise 'You need to activate the deploy extension in config.rb.'
|
36
36
|
end
|
37
37
|
|
38
|
+
build_config_json = false
|
39
|
+
if not File.exists? jspm_dir.gsub(/\/jspm_packages$/,"") + "/config.js"
|
40
|
+
build_config_json = true
|
41
|
+
end
|
42
|
+
|
38
43
|
build_package_json = false
|
39
44
|
if not File.exists? "package.json"
|
40
45
|
build_package_json = true
|
46
|
+
|
41
47
|
File.open("package.json", "w") do |fp|
|
42
48
|
fp.write(JSON.pretty_generate(
|
43
49
|
{
|
@@ -63,7 +69,7 @@ module Middleman
|
|
63
69
|
|
64
70
|
system "node node_modules/jspm/jspm.js #{options.join(" ")}"
|
65
71
|
|
66
|
-
if
|
72
|
+
if build_config_json
|
67
73
|
config_js = File.read(jspm_dir.gsub(/\/jspm_packages$/,"")+"/config.js")
|
68
74
|
config_js.sub!(/^System.config\(\{/,"System.config({\n \"baseURL\": \"#{jspm_dir.sub(/\/jspm_packages$/,"").sub(/^source/,"")}\",")
|
69
75
|
File.open(jspm_dir.gsub(/\/jspm_packages$/,"")+"/config.js", "w") do |fp|
|
data/middleman-jspm.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
spec.required_ruby_version = '>= 1.9.3'
|
20
20
|
|
21
|
-
spec.add_dependency 'middleman-core', '
|
22
|
-
spec.add_dependency 'uglifier'
|
23
|
-
spec.add_dependency 'ejs'
|
21
|
+
spec.add_dependency 'middleman-core', '~> 3.2'
|
22
|
+
spec.add_dependency 'uglifier', '~> 2.5'
|
23
|
+
spec.add_dependency 'ejs', '~> 1.1'
|
24
24
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-jspm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Pilsch
|
@@ -14,44 +14,44 @@ dependencies:
|
|
14
14
|
name: middleman-core
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.2'
|
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
26
|
version: '3.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: uglifier
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.5'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: ejs
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '1.1'
|
55
55
|
description: Use JSPM in Middleman
|
56
56
|
email:
|
57
57
|
- apilsch@tamu.edu
|
@@ -59,6 +59,7 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
+
- ".gitignore"
|
62
63
|
- README.md
|
63
64
|
- lib/middleman-jspm.rb
|
64
65
|
- lib/middleman-jspm/commands.rb
|