Relative path to import sass file does not work - sass

Here is the tree structure of my project
I am trying to import one scss file (available in theme named variables.scss) into the another scss file (named tick-tock.component.scss) but I receive the following error message.
Error: File to import not found or unreadable: ../../theme/variables
here is how I am trying to import the file.
here is how I am trying to import the file.
but if I give the absolute path it works like the following it works. (which ofcourse is wrong way)
#import 'C:/My-Source/angular-component-library/src/theme/variables';

partials/import must be prefixed with an underscore like '_variables.scss'
you can read more about it here in the section "partials": http://sass-lang.com/guide

Related

Run tag-dependent Python script on Sphinx build

I need to run a simple Python script to copy a set of files from one directory to another during the build-phase of my Sphinx documentation.
Copying function:
location: source/_plugins/copy_firmware_files.py
import json, os, sys
from pathlib import Path
import shutil
def copy_firmware_files(device):
# copy firmware files
I'm currently importing this module into my conf.py as the Configuration File contains the device name, which would make it a simple way to execute the code. I'm currently doing this as below:
Configuration File (conf.py)
location: source/conf.py
sys.path.append(os.path.abspath("_plugins"))
from copy_firmware_files import *
# initialize files depending on build
copy_firmware_files(device_name)
The above works as intended, i.e. the relevant files are copied to their respective folders before the build. However, I'm unsure if it's the "proper" way to do so. Is there a more correct way of achieving the same result?
There are several ways, but it sounds like two are most appropriate. They are static files and could be treated as such by Sphinx.
html_extra_path is one option.
If you want to present links to download the files, you can use the download directive.
See :download:`this example script <../example.py>`.

python lambda not able to import user defined modules

I have a python lambda which turns out to be a bit long so we decided to split it into modules. and now when i try to import the module in the lambda_handler its seems to be giving following error
Unable to import module 'defghi': attempted relative import with no known parent package
abc.py which has got lambda_handler in it, is trying to import the defghi.py methods as follows
from defghi import some_method_1, some_method_2
tried this as well
from .defghi import some_method_1, some_method_2
both the files are in the same directory
any sort of help would be appreciated, Thanks in adavance
Finally got that working it was the build scripts which where causing the issue in my project.
The build script which created the zip file where expecting only one .py file in the directory which was a problem. So the zip created never had other files which then gave error cannot import.
So to answer the question its perfectly fine to split the big lambdas into modules and keep them a bit readable and import into the main lambda_handler the required modules.

Code in directory expects import

I have a package which is forked from a repository myproject. Inside the project, I want to use some functions from sha3 package, however, I need to first add a go file to sha3 package which contains some extra functionalities. I want to include this custom sha3 package inside my project. I copied and pasted the sha3 directory into myproject directory, and inside my go codes, I imported sha3 package as:
import . "github.com/myproject/sha3". Now, when I try to build myproject package, I am getting:
code in directory /src/github.com/myproject/sha3 expects import "golang.org/x/crypto/sha3". I cannot understand what the problem is. I checked all the go files inside sha3 directory and none of them requires any import!
line number 66 sha3/docs.go has the import comment.
import "golang.org/x/crypto/sha3"
You can get rid of the build error by removing that.

Sass import not crawling node_modules to find appropriate package

I am using bootstrap-sass. The node module is installed. I should expect I can, in any .scss file, use the below line to import into an appropriate sheet
#import 'bootstrap';
My understanding is what should happen is the compiler crawls up until it finds package.json, hops into node_modules, and finds the appropriate package. Instead I am getting the below error.
Error: File to import not found or unreadable: bootstrap
If I replace my import with a fully qualified path as below, then everything works gravily.
#import '../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap';
I am using gulp-sass to compile. Guessing I just have some minor config bits off but I can't figure out what it is.
Pass the path as an includes path....
Eg. It will look something like this if you're using gulp
.pipe(sass({
includePaths: ['node_modules/bootstrap-sass/assets/stylesheets']
}))
Then you should be fine to use:
#import 'bootstrap';
It will not import stuff like Javascript / Node.js. It will look for the bootstrap file in the same folder as the file which imports it. So yes, you need to use the long path or place the bootstrap file in the same folder.

How to include external file in Go?

I'm using LiteIDE for Go. I have a Go file located here:
/Users/username/go/src/src/Helper/Helper.go
When I include the file using:
import "../Helper"
I get this error:
can't load package: /Users/username/go/src/src/projectA/main.go:4:8:
local import "../Helper" in non-local package
Any ideas what I'm doing wrong?
You import packages by import path. For package Helper, located in $GOPATH/src/Helper/, use:
import "Helper"
While they can work in some cases, relative paths aren't supported by the go toolchain, and are discouraged.

Resources