I’m trying to write a simple Package that will glob my imports for some imports that I’d like to have fourseven:scss load as partials.
So I created a simple packages/glob-scss/package.js
file with:
Package.describe({
name: 'capsulecat:glob-scss',
version: '0.0.1',
summary: 'Glob files in your imports directory',
});
Package.onUse(function (api) {
api.use('fourseven:scss');
var path = Npm.require('path');
var glob = Npm.require('glob');
var options = {
cwd: path.join(path.resolve('.')),
};
var files = glob.sync('imports/**/*.scss', options);
files = files.map(f => path.join(path.resolve('.'), f));
api.addFiles(files, ['client'], { isImport: true });
});
Cool, if I console log the files
right before the api.addFiles
line, I get what I expect, an array with absolute paths to the .scss
files in my imports
folder. But then meteor will crash on startup with:
Error: ENOENT: no such file or directory, open '/Users/idmontie/Desktop/meteor-app/packages/glob-scss/imports/packages/Fab/components/_Fab.scss'
Okay, so even though I gave Meteor a full absolute path to the file, it tried to open a file in my packages folder instead.
Are packages sandboxed? If I try to pass in a hardcoded value of: ['../../imports/packages/Fab/components/_Fab.scss']
, I get Error: Path contains forbidden segment '..'
.
All I’m really trying to do here is customize my build. What I’d really like to do is just glob import all the scss partials in my imports directory, but fourseven:scss
doesn’t support glob imports, so here I am trying to glob import using a package.
If there’s a better way to do that, please let me know.