mathiasbynens / luamin

A Lua minifier written in JavaScript
https://mths.be/luamin
MIT License
217 stars 54 forks source link

Can't minify from shell on mac #55

Closed Jerakin closed 6 years ago

Jerakin commented 6 years ago

I have a very simple bash script that should give me all lua files

cd "/Users/jerakin/folder/with/luafiles"

find `pwd` -name "*.lua" | while read line ; do
    if [ -f "$line" ]
    then
        echo $line
        luamin -f $line
    fi
done

The output this gives me is the following

/Users/mattias.hedberg/Documents/repositories/git/presto/world/entities/avatars/avatar.lua
Error: no such file. (``)

I have even tried to output the list of files to a text file and then iterating it but I get the same error

cd "/Users/jerakin/folder/with/luafiles"
echo "" > /Users/jerakin/Desktop/out.txt

find `pwd` -name "*.lua" | while read line ; do
    echo $line >> /Users/jerakin/Desktop/out.txt
done

while read p; do
    if [ -f "$p" ]
    then
        luamin -f $p
    fi

done </Users/jerakin/Desktop/out.txt

macOS High Sierra version 10.13.3

luamin --version v1.0.4

mathiasbynens commented 6 years ago

Why do you use:

find `pwd` -name "*.lua"

…instead of…

find . -name "*.lua"

?

What does the output of your command (and thus also /Users/jerakin/Desktop/out.txt) look like?

Jerakin commented 6 years ago

Used pwd instead of dot because I wanted the absolute pathname.

Using pwd gives me the output: /Users/jerakin/Desktop/luamin_me/location_tags.lua

Using . gives me ./location_tags.lua

The file path gets echoed into the out.txt. But luamin gives the errror Error: no such file. (``)

Jerakin commented 6 years ago

So in both cases the path gets passed along to luamin properly