lux_assets 0.1.4 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/README.md +23 -3
- data/bin/lux_assets +1 -1
- data/lib/lux_assets/asset.rb +3 -3
- data/lib/lux_assets/element.rb +3 -5
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19e3444190ac43795cf9324c49254bb488bc0a0389183023fe26a74cd16bf4a1
|
4
|
+
data.tar.gz: c3a57a2171d34b41ddae69ab0fc3222345818461bb6921d4886178e169c09b37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1e7bb7e258f08b3ac474394ab5bb31a94a0a5728c438b70085b4c4f874d1257f58922e0089e5b29f9936bce5fc7a15601233b032706ffc33aa77cd9fc25b97b
|
7
|
+
data.tar.gz: ad79d073f0328fbb30d1d0d39ae67c5edd4c1c0388ea8043f35685dcb0dc77f586895eeab4bc5eb79ec3a8588220af223aa3b2e7e2d9837ca5da41140d2bf571
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 - 2018 Flow Commerce Inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Lux web assets
|
2
2
|
|
3
3
|
Lightweight web assets packer that loves simplicity.
|
4
4
|
|
@@ -32,7 +32,7 @@ Commands:
|
|
32
32
|
```
|
33
33
|
|
34
34
|
1. Start with `lux_assets install`
|
35
|
-
2. Modify
|
35
|
+
2. Modify `./config/assets.rb`
|
36
36
|
3. Compile with `lux_assets compile`
|
37
37
|
4. Inspect added files with `lux_assets show`
|
38
38
|
|
@@ -108,10 +108,14 @@ If you add proc, proc retun must be a string, not a file
|
|
108
108
|
|
109
109
|
This is all that is needed to add support for TypeScript compilation.
|
110
110
|
|
111
|
+
```
|
112
|
+
yarn add typescript
|
113
|
+
```
|
114
|
+
|
111
115
|
```
|
112
116
|
class LuxAssets::Element
|
113
117
|
def compile_ts
|
114
|
-
|
118
|
+
system "node_modules/typescript/.bin/tsc --outFile '#{@cache}' '#{@source}'"
|
115
119
|
end
|
116
120
|
end
|
117
121
|
```
|
@@ -138,3 +142,19 @@ In `Rakefile` just add `require 'lux_assets'` and tasks will automaticly be adde
|
|
138
142
|
|
139
143
|
Rake taks will call :env task to set up environment.
|
140
144
|
|
145
|
+
```
|
146
|
+
# Rakefile
|
147
|
+
|
148
|
+
require 'lux_assets'
|
149
|
+
|
150
|
+
task :env do
|
151
|
+
# require './config/application'
|
152
|
+
end
|
153
|
+
|
154
|
+
task :default do
|
155
|
+
puts 'rake -T to get all tasks'
|
156
|
+
end
|
157
|
+
```
|
158
|
+
|
159
|
+
To test, `rake -T`
|
160
|
+
|
data/bin/lux_assets
CHANGED
@@ -32,7 +32,7 @@ class AssetsCli < Thor
|
|
32
32
|
|
33
33
|
desc :install, 'Install all needed packages via yarn'
|
34
34
|
def install
|
35
|
-
packages = ["coffee-script", "
|
35
|
+
packages = ["coffee-script", "node-sass", "typescript", "babel-cli", "autoprefixer-cli"]
|
36
36
|
|
37
37
|
if `which yarn`.empty?
|
38
38
|
Cli.die('yarn not found -> install with "npm install yarn -g"')
|
data/lib/lux_assets/asset.rb
CHANGED
@@ -27,7 +27,7 @@ class LuxAssets::Asset
|
|
27
27
|
if file.is_a?(Proc)
|
28
28
|
@data.push file.call
|
29
29
|
else
|
30
|
-
@data.push LuxAssets::Element.new(file
|
30
|
+
@data.push LuxAssets::Element.new(file).compile
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -60,8 +60,8 @@ class LuxAssets::Asset
|
|
60
60
|
|
61
61
|
def compile_js
|
62
62
|
save_data @data.join(";\n") do
|
63
|
-
# minify
|
64
|
-
LuxAssets.run '
|
63
|
+
# babel fix and minify
|
64
|
+
LuxAssets.run 'node_modules/babel-cli/.bin/babel --minified --no-comments --compact true -o "%{file}" "%{file}"' % { file: @asset_path }
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
data/lib/lux_assets/element.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
# One file that can be scss, js, coffee, ts, etc...
|
2
2
|
class LuxAssets::Element
|
3
|
-
|
4
|
-
|
5
|
-
def initialize source, opts={}
|
3
|
+
def initialize source
|
6
4
|
@source = Pathname.new source
|
7
|
-
@opts = opts
|
8
5
|
@cache = Pathname.new './tmp/assets/%s' % source.gsub('/','-')
|
9
6
|
end
|
10
7
|
|
@@ -29,7 +26,8 @@ class LuxAssets::Element
|
|
29
26
|
private
|
30
27
|
|
31
28
|
def production?
|
32
|
-
|
29
|
+
# if building from Rake then we are compiling for production
|
30
|
+
ENV['LUX_ASSETS_ENV'] == 'production' || defined?(Rake)
|
33
31
|
end
|
34
32
|
|
35
33
|
def cached
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lux_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dino Reic
|
@@ -60,6 +60,7 @@ executables:
|
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
|
+
- "./LICENSE"
|
63
64
|
- "./README.md"
|
64
65
|
- "./bin/lux_assets"
|
65
66
|
- "./lib/lux_assets.rb"
|