commit 62f51c281cc003ce1d6564e5cb35261a6ead9aee
parent 1bf3bbc1e75b6e0126bbffbb9876c24a5c28ea8b
Author: Hugo Soucy <hugo@soucy.cc>
Date: Wed, 26 Jan 2022 23:01:51 -0500
Return the first result only
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/cssmin b/cssmin
@@ -13,6 +13,8 @@
$ echo ".red { color: red; }" | ./cssmin
]]
+local inspect = require 'inspect'
+
do
local function minify(css)
return css
@@ -38,7 +40,8 @@ do
end
if extension == '.css' then
- return print(minify(read(file)))
+ local minified, _ = minify(read(file))
+ return print(minified)
else
print "[Error!] Wrong file type. It should be a 'text/css'."
end
@@ -49,7 +52,9 @@ do
css[#css+1] = line
end
- return print(minify(table.concat(css)))
+ local minified, _ = minify(table.concat(css))
+
+ return print(minified)
elseif not arg[1] then
print "An argument is missing. You sould add a CSS file as argument."
else