dart sass create subfolder for each generated css file - dart-sass

This is my file structure:
- root/
-- component1/
-- style.scss
-- component2/
-- style.scss
I want to run the sass command so that I get this stucture:
- root/
-- component1/
-- style.scss
-- gen/
-- style.css
-- component2/
-- style.scss
-- gen/
-- style.css
When I try the command sass root I get this:
- root/
-- component1/
-- style.scss
-- style.css
-- component2/
-- style.scss
-- style.css
How can I change the command so that it created a sub folder named gen and puts the generated css files in it?

Related

How to better control the output location of files produced by rollup

I have the following source directory structure:
-- browser/
client.html
client.js
When I run rollup it produces:
-- dist/
browser/
client.html
assets/
client-7878f.js
I'd like it to output:
-- dist/
client.html
assets/
client-7878f.js
How would one achieve that?
My rollup options are:
{
input: 'browser/client.html',
},

Different behaviour when producing annotations with Erlang Typer

I am using the typer_core module of Dialyzer to automatically infer typespecs. However, I am obtaining different behaviour based on whether the files specified are prepended with the . character or not. The behaviour described below only affects files located in the directory where the typer command is run; files in child directories are processed as expected by Typer.
Consider the module test.erl:
-module(test).
is_a_ok(a) -> ok.
The behaviour below is produced when evaluating the following expressions on the REPL:
% Prepending with the '.' character.
% Creates the file ./typer_ann/test.ann.erl, but is NOT annotated.
typer_core:run(#{mode => annotate, files => ["./test.erl"]}).
Processing file: "./test.erl"
Saved as: "./typer_ann/test.ann.erl"
% Does NOT annotate the file ./test.erl.
typer_core:run(#{mode => annotate_in_place, files => ["./test.erl"]}).
Processing file: "./test.erl"
Saved as: "./test.erl"
% Without the '.' character.
% Creates the file ./typer_ann/test.ann.erl, and is annotated.
typer_core:run(#{mode => annotate, files => ["test.erl"]}).
Processing file: "test.erl"
Saved as: "./typer_ann/test.ann.erl"
% Annotates the file ./test.erl.
typer_core:run(#{mode => annotate_in_place, files => ["test.erl"]}).
Processing file: "test.erl"
Saved as: "test.erl"
Using . in conjunction with the files_r key (equivalent to the -r command line switch) processes directories recursively. I observed the same behaviour described above when attempting to annotate files with the files_r key, specifying . as the starting directory:
% Does NOT annotate any of the files in the current directory.
typer_core:run(#{mode => annotate_in_place, files_r => ["."]}).
Processing file: "./test.erl"
Saved as: "./test.erl"
This can be reproduced using Typer on the command line:
# Does NOT annotate the file ./test.erl.
$ typer --annotate-in-place ./test.erl
Processing file: "./test.erl"
Saved as: "./test.erl"
# Does NOT annotate any of the files in the current directory.
$ typer --annotate-in-place -r .
Processing file: "./test.erl"
Saved as: "./test.erl"
Note that, however, *.erl files in child directories do get annotated in the first and last examples, i.e. using typer_core:run(#{mode => annotate_in_place, files_r => ["."]}) and typer --annotate-in-place -r . The following examples also work:
# Annotates the file ./test.erl (no . in front of the file name).
$ typer --annotate-in-place test.erl
Processing file: "test.erl"
Saved as: "test.erl"
# Annotates the file test.erl (. in front of the directory, one directory up).
$ typer --annotate-in-place ./typer_test/test.erl
Processing file: "./typer_test/test.erl"
Saved as: "./typer_test/test.erl"
I might be missing something and would appreciate any suggestions regarding this behaviour. I am using OTP 25.0.4.

How would I go up a directory in lua?

Let's say I have a root folder like this:
--+ Folder
+-+ OtherFolder
| +-- main.lua
+-+ AnotherFolder
+-- output.txt
And I want main.lua to use io.output() and set the .txt file to be in the "AnotherFolder" folder. What would I do?
I've tried using io.output(";../AnotherFolder/output.txt) and io.output("../AnotherFolder/output.txt) however they give me the "no such file or directory" error (The file does exist).
The file path is relative to the directory you run the script from.
For example imagine I have a directory layout like this:
foo/
bar/
main.lua
baz/
file.txt
and my main.lua looks like this
io.output('../baz/file.txt')
io.write('Hello World!')
If I run the program from the bar directory it works, but if I run it from the foo directory you get
cannot open file '../baz/file.txt' (No such file or directory)
You would need to change the file path to baz/file.txt to make it work from that directory.

I2C devices on docker container

I am running a docker container on Raspberry Pi 3 and I am trying to read from an I2C device from the container. When I use i2cdetect inside docker I can see the devices. The run option I use is sudo docker run --device /dev/i2c-1 --name <name> <image>, but when I try to read from the I2C device all CRC checks fail as if the file /dev/i2c-1 didn't mount correctly. It looks like the directory has just been copied on run and did not bind. Has anyone else experienced this?
I have also tried the --privileged option and binding the folder -v -v /dev:/dev.
I can't use i2cget to test the device because it uses 16bit addressing
I use the wiringPi library for C https://github.com/WiringPi/WiringPi.
On run I get these messages:
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
systemd-timesync:x:100:103:systemd Time Synchronization,,,:/run/systemd:/bin/false
systemd-network:x:101:104:systemd Network Management,,,:/run/systemd/netif:/bin/false
systemd-resolve:x:102:105:systemd Resolver,,,:/run/systemd/resolve:/bin/false
systemd-bus-proxy:x:103:106:systemd Bus Proxy,,,:/run/systemd:/bin/false
_apt:x:104:65534::/nonexistent:/bin/false
Output from i2cdetect -y 1 in docker:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: 70 -- -- -- -- -- -- --

Lua require not working

I am trying to make one lua file require another. I am following this guide: http://lua-users.org/wiki/ModulesTutorial
My basic test, which should be a trivial hello world, does not work, and I can't figure out why.
Here's a console log which shows all files and all errors:
C:\Users\TestUser\Desktop\LuaTest>dir
Volume in drive C has no label.
Volume Serial Number is XXXX-XXXX
Directory of C:\Users\TestUser\Desktop\LuaTest
11/15/2017 03:03 PM <DIR> .
11/15/2017 03:03 PM <DIR> ..
11/15/2017 02:53 PM <DIR> Bar
11/15/2017 03:04 PM 92 BazModule.lua
11/15/2017 02:53 PM <DIR> Foo
11/15/2017 03:08 PM 139 main.lua
2 File(s) 231 bytes
4 Dir(s) 253,774,073,856 bytes free
C:\Users\TestUser\Desktop\LuaTest>lua main.lua
lua: main.lua:1: module 'BazModule' not found:
no field package.preload['BazModule']
no file 'C:\dev\LuaDist\bin'
no file '.\BazModule.dll'
no file 'C:\dev\LuaDist\bin\..\lib\lua\BazModule.dll'
no file 'C:\dev\LuaDist\bin\..\lib\lua\loadall.dll'
stack traceback:
[C]: in function 'require'
main.lua:1: in main chunk
[C]: ?
C:\Users\TestUser\Desktop\LuaTest>type main.lua
local baz = require("BazModule")
baz.Baz()
local bar = require("Bar.BarModule")
bar.Bar()
local foo = require("Foo.FooModule")
foo.Foo()
C:\Users\TestUser\Desktop\LuaTest>type BazModule.lua
local BazModule = {}
function BazModule.Baz()
print("Hello Baz!")
end
return BazModule
C:\Users\TestUser\Desktop\LuaTest>lua -v
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
The expected output should be
Hello Baz!
Hello Bar!
Hello Foo!
But it can't find any of the files adjacent to main.lua and I don't understand why.
require searches in directories listed in package.path (for Lua files) and package.cpath (for compiled libraries).
Your error message…
lua: main.lua:1: module 'BazModule' not found:
no field package.preload['BazModule']
no file 'C:\dev\LuaDist\bin'
no file '.\BazModule.dll'
no file 'C:\dev\LuaDist\bin\..\lib\lua\BazModule.dll'
no file 'C:\dev\LuaDist\bin\..\lib\lua\loadall.dll'
indicates the paths that require searched in. It seems that package.path is completely empty, or maybe there's a single malformed path pattern in there. (Which would be C:\dev\LuaDist\bin.)
The way the search for a module foo.bar works is that ? is substituted by foo/bar (or foo\bar – depending on OS) and so ./?.lua would find ./foo/bar.lua.
So the way to fix this is to (a) fix the place where you (or something that you installed) are/is mangling the package.path (via environment variable, startup script, …?) and/or (b) add the current directory to the search path.

Resources