Meteor package naming error - meteor

I've been working on a Meteor package for some time now and I have been been using a Meteor SCSS build package to compile my sass. Now for reasons like autoprefixer and such, I need to compile the SCSS outside of Meteor. My plan was to use Codekit but when I try to build the SCSS I get an error with no message at all. When I use the Sublime Text 2 SCSS build package I get an error as well. I have come to the conclusion that this is because of my Meteor package name. I have named it:
myusername:packagename
and as a folder that translates to
myusername/packagename
It replaces : with / and because of that, Codekit thinks the folder named myusername/packagename is two folders myusername -> packagename. That messes up the folder tree when Codekit tries to compile it.
Is there a good way to handle this?

To solve this problem, you can rename the directory of the package and then add an entry inside the Package.describe call in package.js:
Package.describe({
summary: "My package",
version: "0.0.1",
name: "myusername:packagename"
});
Now, the name of the package will be read from package.js and the directory can be called whatever you want.

Related

.jshintrc with Gulp, Jhipster

When I want to set "Underscore" (I used to use 'Grunt') and I put in .jshintrc.
"globals": {
"_": false,
Now with version 3.5.1 of Jhipster I use Gulp and I do not know how to configure it because there is no file .jshintrc.
Ans it gives me the error
angular.js:13550 ReferenceError: _ is not defined
Can somebody help me. Thank you.
JHipster replaced jshint with eslint in this change. Because of this, you should add the globals section to the file .eslintrc.json the same as it was in .jshintrc. (Similar issue)
Based on the ReferenceError from Angular, it looks like you don't have Underscore as a dependency in your index.html. Run bower install underscore --save to download and install Underscore (this adds it to bower.json), then run gulp inject:dep to inject the dependencies to index.html automatically.

How to use Laravel 5 with Gulp, Elixir and Bower?

I am completely new to all this, 'Bower' and 'Gulp' and Laravel 'Elixir'. I purchased a template that uses them (unfortunately) and now I need some help on how to go about implementing them. I have already installed NPM and Bower. All my packages have been downloaded into:
resources > assets > vendor
This is a screenshot:
Now my question is how do I include all those packages I downloaded in my view? From my understanding I can't run less files directly in the browser, it only runs once due to 'browser caching' or something like that, also the JS scripts are just too many to include in my page.
I want a way where I can work on my files and have them automatically compiled with the compiled files being referenced in my app.php file.
This is a link to the GulpJS file included in my template: http://pastebin.com/3PSN6NZY
You do not need to compile every time someone visits. The compiled sass/js should be run in dev and then the output files referenced.
If you have gulp installed on the project, you should see a gulp.js file in the root of your project. If not, visit here for instructions:
Gulp/Elixer installation and setup
In your gulp.js file:
var elixir = require('laravel-elixir');
elixir(function(mix) {
mix.less([
'app.less',
'normalize.less',
'some-other-less.less',
'and-another.less'
]);
mix.scripts(['app.js', 'some-other-js.js'], 'public/js/output-file.js');
});
While in development you can run gulp watch from the command line to listen for changes and run compile tasks when it hears a change. Then you simply reference the output files in the public directory as you normally would.
If you don't want to listen, you can just run the gulp command for a single once-off task run.
The docs are pretty straight forward and can be found here:
Gulp/Elixer docs

how to wrap a library without build files in meteor package

I try to wrap a javascript library with a meteor package.
When i fork the library it has no built javascript file inside the repository. Normally someone would run grunt dist to build the dist/library.js file.
Meteor Package description:
Package.onUse(function(api) {
api.addFiles([
'dist/library.js',
])
})M
this can't work because the file does not exist yet.
How can i create a package from that library? is coping the library.js file the only way?
If you want to do this, you're going to have to require Grunt, run Grunt through the JavaScript API (not the CLI) to compile dist/library.js, and then require it.
It would be much easier to just compile it outside of Meteor and place it in the folder, but if you want to do things The Right Way™ that's how you'd do it. Let me know if you have any implementation-specific questions!

How to tell Meteor to ignore `gulpfile.js`

In my meteor project I want to use gulp for tasks meteor doesn't support.
Anyway, the problem is that gulp uses a file called gulpfile.js which is loaded by meteor too and gives errors. So my question is, is there a way to tell meteor to ignore some files ?
UPDATE: One solution I can think of is to put gulpfile.js in the folder packages or public and run gulp as follows
$> gulp --gulpfile packages/gulpfile.js
UPDATE: Just noticed that meteor also seems to load node_modules files :(
Unfortunately, in the current release there's no way to tell Meteor to leave certain files alone, so you cannot have gulpfile.js in your main app folder.
You can, however, leave it in an ignored subfolder. Meteor ignores files and directories that ends with tilde ~, the /tests directory and all private files (those beginning with a dot .). So you can create a folder named for example gulp~ and use it for your gulp-related stuff.
The same holds for node_modules folder, you cannot have it in your application, and you shouldn't. If you want to use a node package in your Meteor application, you can do this with npm package.
Add it to your project with mrt add npm command.
Then create packages.json file with a list of all required packages, for example:
{
"something": "1.5.0",
"something-else": "0.9.11"
}
Afterwards, include your package with Meteor.require:
var something = Meteor.require('something');
If you want to use a node package in your gulp tasks, install it inside the ignored directory.

How to modify/edit a Meteor package?

I want to run two different Meteor apps on the same server (on different ports) but I want to change something in one of Meteor's core packages and I want one app to use the original package and the other app to use the modified one. How could I do it?
A bit more straightforward answer, based on answer from here :
Create packages folder in your project and change location to that folder ('cd yourproject' && 'mkdir packages' && 'cd packages')
Fetch files from git ('git clone https://github.com/YOUR_PACKAGE_ADDRESS' - you need to have git installed)
Inside fetched package folder find package.js and edit inside 'Package.describe' name value, for example by adding '-manually-modified'
Edit files you need to modify inside fetched package folder.
Add package to project (meteor add package-name-manually-modified)
You can get the package's files at the github repo : https://github.com/meteor/meteor/tree/master/packages
Fetch the files you want except the package.js files and add them to your project. Of note is you need to ensure their loading order sometimes so you might have to modify the file names, to have a look at the loading order have a look at package.js. By default meteor orders file by name but packages don't necessarily use that.
You can avoid renaming the files if you just mod the package and add it back using meteorite : https://github.com/oortcloud/meteorite
Full instructions on how to make a smart.json : https://atmosphere.meteor.com/wtf/package. If its anything nice please consider adding it to atmosphere too!
I have my packages in my user folder at its root as a hidden folder called .meteor.
Perhaps you can check there? On a mac it would be under:
~/.meteor/packages/your package name
You must also now go into a file there os.json, and change the "length" variable for the file you changed to match the new byte file size. Otherwise it might not compile, but try compiling first and see if its an issue that you changed some package code.

Resources