Skip to content

Commit 50d3725

Browse files
authored
Merge pull request #182 from aktos-io/dev
Dev
2 parents ac9e534 + b83fc84 commit 50d3725

File tree

8 files changed

+56
-15
lines changed

8 files changed

+56
-15
lines changed

components/router/index.ls

+12-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ require! 'aea': {sleep}
22
require! 'prelude-ls': {take, drop, split, find}
33
require! 'actors': {RactiveActor}
44

5+
basename = (.split(/[\\/]/).pop!) # https://stackoverflow.com/questions/3820381#comment29942319_15270931
56

67
get-offset = ->
78
$ 'body' .scrollTop!
@@ -88,8 +89,17 @@ Ractive.components['a'] = Ractive.extend do
8889
return eval that
8990

9091
if href?
91-
link = parse-link href
92-
if link.external
92+
link = if @get('download') then {+download} else parse-link href
93+
if link.download
94+
filename = basename(href)
95+
link = document.createElement("a")
96+
link.setAttribute("target","_blank")
97+
link.setAttribute("href", href)
98+
link.setAttribute("download",filename)
99+
document.body.appendChild(link)
100+
link.click()
101+
document.body.removeChild(link)
102+
else if link.external
93103
if @get \curr-window
94104
window.open href, "_self"
95105
else

doc/Pug/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Using Markdown
2+
3+
```
4+
:markdown-it
5+
# Markdown
6+
7+
Markdown document with http://links.com and
8+
9+
```js
10+
var codeBlocks;
11+
```

doc/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Here you can find useful links and cheatsheets:
44

55
* [CouchDB](./CouchDB)
66
* [Ractive](./Ractive)
7+
* [Pug](./Pug)
78
* [Available Libraries](./available-libraries.md)
89
* [Publishing Static Content](./publishing-static-content.md)
910
* [Supported Development Platforms](./supported-development-platforms.md)

gulpfile.ls

+16-11
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ my-buble = (input) ->
235235
es5.code
236236

237237
browserify-cache = {}
238-
238+
extra-time = 0
239239
get-bundler = (entry) ->
240240
b = browserify do
241241
entries: [entry]
@@ -256,9 +256,11 @@ get-bundler = (entry) ->
256256
..transform (file) ->
257257
through (buf, enc, next) ->
258258
content = buf.to-string \utf8
259+
t0 = Date.now!
259260
try
260261
#@push "__DEPENDENCIES__ = #{__DEPENDENCIES__}; \n #{content}"
261262
@push content.replace /__DEPENDENCIES__/g, JSON.stringify(__DEPENDENCIES__)
263+
extra-time += Date.now! - t0
262264
next!
263265
catch _ex
264266
@emit 'error', _ex
@@ -329,6 +331,8 @@ gulp.task \browserify, ->
329331
b-count-- if b-count > 0
330332
if b-count is 0
331333
log-info \browserify, "Browserify finished"
334+
console.log "Extra time: #{extra-time / 1000}s"
335+
extra-time := 0
332336
first-browserify-done := yes
333337
b-count := files.length
334338
console.log "------------------------------------------"
@@ -474,20 +478,21 @@ gulp.task \dependencyTrack, ->
474478
dump-file "tmp-browserify-cache", browserify-cache
475479
*/
476480

477-
# invalidate all dependencies to refresh __DEPENDENCIES__ string
478-
console.log "=== Invalidating all Browserify cache due to commit change: "
479-
console.log "===", JSON.stringify(__DEPENDENCIES__)
480-
processed.length = 0
481-
for f, c of browserify-cache
482-
if f.ends-with ".ls" and f not in processed
483-
processed.push f
484-
#console.log "invalidating : #{f}"
485-
touch.sync f
481+
unless _browserify_change_flag
482+
# invalidate all dependencies to refresh __DEPENDENCIES__ string
483+
console.log "=== Invalidating all Browserify cache due to commit change: "
484+
console.log " ", JSON.stringify(__DEPENDENCIES__)
485+
processed.length = 0
486+
for f, c of browserify-cache
487+
if f.ends-with ".ls" and f not in processed
488+
processed.push f
489+
#console.log "invalidating : #{f}"
490+
touch.sync f
486491

487492
#console.log preparserify-dep-list
488493
gulp.start \browserify
489494
_browserify_change_flag := false
490495
processing := no
491496

492497
<~ sleep 1000ms
493-
lo(op)
498+
lo(op) unless argv.production

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"gulp-util": "^3.0.8",
2525
"jquery": "^3.2.1",
2626
"jquery-mousewheel": "^3.1.13",
27+
"jstransformer-markdown-it": "^2.1.0",
2728
"livescript": "~1.6.0",
2829
"marked": "^0.3.12",
2930
"mathjs": "^4.2.2",

production-build.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
set -eu -o pipefail
3+
safe_source () { [[ ! -z ${1:-} ]] && source $1; _dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"; _sdir=$(dirname "$(readlink -f "$0")"); }; safe_source
4+
# end of bash boilerplate
5+
6+
app=${1:-}
7+
if [[ -z $app ]]; then
8+
echo "Usage: "
9+
echo " $(basename $0) your-app-name"
10+
exit 3
11+
fi
12+
cd $_sdir
13+
gulp --production --webapp $app

watch.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ restart(){
3131
fi
3232
done
3333
}
34-
34+
cd $_sdir
3535
rm -r $_sdir/build/$1 2> /dev/null
3636
compile $1 &
3737
restart

0 commit comments

Comments
 (0)