lux_assets 0.2.9 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c75902022d21e66908e7e48471de558834e110f4626f9354bc273bd803eddbf0
4
- data.tar.gz: ff67b5d01baa0da7d1483aa7d1c03d0257f6e76ec1c99c21fed7c622f3a375ea
3
+ metadata.gz: 4f9ba98ceb4edc98e62f911ff766af972e50bc59588eb8b7d36ecd7a995e58a0
4
+ data.tar.gz: 9b2a7488ce6765aff888c7494bb86a1c36194972925db18b5d78561acfd740d0
5
5
  SHA512:
6
- metadata.gz: 89954e9a9b594a6a11ae234b163a01222be0d7f9344d1cbe3ec1d87c801be5b17539ba618d15dcf6f1c2918047a22f4d51ef7f6285ed5164b7bb978e50451ad4
7
- data.tar.gz: da9b2a0ca0c94bc94131a24f9075698507ca766fa3cd6f4b4663faec33b20a74d27857c7e9e3ae90859779215bb5e212384fe08abddb886e03b37307f1c1c7ef
6
+ metadata.gz: 9296f15fd82f2ad4d36479ff29d531dcb4b25959e5317e2b2e5e46814cd1a4540a7f03de3b7d16eb67c93b054aaec48d606a19c1472dec86dbdc547ad8b26a27
7
+ data.tar.gz: ba5666fb285cccf49849bd015ecfd22f4c1dbb0939a939bde79008f1ddbc60a31c157a596df65db8ed758f338f6bbd005e6ab4403b8a307ef61dbebe391b9e70
data/README.md CHANGED
@@ -2,18 +2,20 @@
2
2
 
3
3
  Lightweight web assets packer that loves simplicity.
4
4
 
5
+ [![asciicast](https://asciinema.org/a/IanaNAq9CDKvUg7dweqxzhoAV.svg)](https://asciinema.org/a/IanaNAq9CDKvUg7dweqxzhoAV)
6
+
5
7
  * framework agnostic, use anywhere
6
8
  * compiles js, coffee, typescript, css, sass "out of the box"
7
9
  * keeps manifest in a single file
8
10
  * plugable to handle any other extension
9
11
  * update manifest file for production
10
12
  * autoprefixer, minify, gzip the output
11
- * add rake tasks
13
+ * adds rake tasks
12
14
 
13
15
  Assets pipeline
14
16
 
15
17
  * get list of files or data
16
- * compile every file individually and join the result to single file
18
+ * individually compile every asset, join the result in a single file
17
19
  * css specific
18
20
  * scan css source and put sh1 data stamp to files found in ./public dir
19
21
  * autoprefixer
data/bin/lux_assets CHANGED
@@ -6,6 +6,14 @@ require 'awesome_print'
6
6
 
7
7
  ###
8
8
 
9
+ if ['-v', '--version'].include?(ARGV[0])
10
+ puts 'v%s' % Pathname.new(__dir__).join('../.version').read.chomp
11
+ exit
12
+ end
13
+
14
+ ###
15
+
16
+ # Load app if possible
9
17
  if ARGV[0]
10
18
  if File.exist?('./config/application.rb')
11
19
  require './config/application.rb'
@@ -92,7 +100,10 @@ class AssetsCli < Thor
92
100
  def monitor
93
101
  LuxAssets::Cli.monitor
94
102
  end
95
-
96
103
  end
97
104
 
105
+ ###
106
+
107
+ trap("SIGINT") { Cli.die 'ctrl+c exit' }
108
+
98
109
  AssetsCli.start ARGV
@@ -123,7 +123,7 @@ module LuxAssets
123
123
  data.each do |ext, value_hash|
124
124
  puts ext.to_s.upcase.green
125
125
  value_hash.each do |key, files|
126
- puts ' %s' % key.green
126
+ puts ' %s' % key.to_s.green
127
127
 
128
128
  total = 0
129
129
 
@@ -15,11 +15,7 @@ class LuxAssets::Element
15
15
  [:css, :scss].include?(@ext) ? 'text/css' : 'text/javascript'
16
16
  end
17
17
 
18
- ###
19
-
20
- private
21
-
22
- # use LuxAsset.compile
18
+ # use LuxAsset.compile if possible
23
19
  def compile force:nil, production:nil
24
20
  @production = production || false
25
21
  method_name = 'compile_%s' % @source.to_s.split('.').last.downcase
@@ -31,6 +27,10 @@ class LuxAssets::Element
31
27
  end
32
28
  end
33
29
 
30
+ ###
31
+
32
+ private
33
+
34
34
  def cached
35
35
  @cache.exist? && (@cache.ctime > @source.ctime) ? @cache.read : false
36
36
  end
@@ -24,13 +24,13 @@ module HtmlHelper
24
24
  def asset file, opts={}
25
25
  opts = { dev_file: opts } unless opts.class == Hash
26
26
 
27
+ # return internet links
28
+ return asset_include file if file.starts_with?('/') || file.starts_with?('http')
29
+
27
30
  if Lux.config(:compile_assets)
28
31
  # return second link if it is defined and we are in dev mode
29
32
  return asset_include opts[:dev_file] if opts[:dev_file]
30
33
 
31
- # return internet links
32
- return asset_include file if file.starts_with?('/') || file.starts_with?('http')
33
-
34
34
  # try to create list of incuded files and show every one of them
35
35
  files = LuxAssets.files(file) || []
36
36
  data = files.inject([]) do |total, asset|
data/misc/demo.bash ADDED
@@ -0,0 +1,29 @@
1
+ # asciinema rec --overwrite tmp/demo.case
2
+ # bash demo.bash
3
+
4
+ type_and_run () {
5
+ printf '\033[01;37m@app $\033[0m '
6
+ for ((i=0; i<${#1}; i++)); do echo "after `jot -r 1 20 60`" | tclsh; printf "${1:$i:1}"; done;
7
+ echo;
8
+ $1;
9
+ echo;
10
+ }
11
+
12
+ info () {
13
+ echo $1 | lolcat
14
+ }
15
+
16
+ info 'DEMO > Clear all assets'
17
+ type_and_run 'bundle exec lux_assets clear'
18
+ info 'DEMO > Show config'
19
+ type_and_run 'cat config/assets.rb'
20
+ sleep 2
21
+ info 'DEMO > Show all assets/fils in config collection'
22
+ type_and_run 'bundle exec lux_assets show'
23
+ sleep 1
24
+ info 'DEMO > Production compile all assets'
25
+ type_and_run 'bundle exec lux_assets compile'
26
+ info 'DEMO > Live monitor, error trigger, and valid compile'
27
+ sleep 2
28
+ type_and_run 'bundle exec lux_assets monitor'
29
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lux_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dino Reic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-04 00:00:00.000000000 Z
11
+ date: 2018-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -73,6 +73,7 @@ files:
73
73
  - "./lib/vendor/lux/misc.rb"
74
74
  - "./lib/vendor/tasks.rb"
75
75
  - "./misc/assets.rb"
76
+ - "./misc/demo.bash"
76
77
  - "./node_modules/abbrev/LICENSE"
77
78
  - "./node_modules/abbrev/README.md"
78
79
  - "./node_modules/abbrev/abbrev.js"