andrewdavey / knapsack

Project moved to https://github.com/andrewdavey/cassette
MIT License
24 stars 3 forks source link

Files not being removed when references are removed #1

Open jslaybaugh opened 13 years ago

jslaybaugh commented 13 years ago

In my index.cshtml, I have the following

@{
    ViewBag.Title = "File Manager";
    Html.AddScriptReference("Content/js/app.files.js");
}

and at the top of app.files.js, I have the following

/// <reference path="app.init.js" />
/// <reference path="common.date.js" />
/// <reference path="jquery.tmpl.min.js" />
/// <reference path="jquery.ba-bbq.min.js" />
/// <reference path="jquery.ba-throttle-debounce.min.js" />

but then I was moving stuff around and decided to take the last three references out since they are already minified and never change and really used by every page in my app. So now, the top of app.files.js looks like:

/// <reference path="app.init.js" />
/// <reference path="common.date.js" />

However, I'm noticing that when I run my app and view source, I see:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js"></script>
<script type="text/javascript" src="/Content/js/modernizr-1.7.min.js"></script>
<script type="text/javascript" src="/Content/js/jquery.ba-bbq.min.js"></script>
<script type="text/javascript" src="/Content/js/jquery.ba-throttle-debounce.min.js"></script>
<script type="text/javascript" src="/Content/js/jquery.tmpl.min.js"></script>
<script src="/Content/js/app.init.js?nocache=634409743120466301" type="text/javascript"></script>
<script src="/Content/js/common.date.js?nocache=634409743120466301" type="text/javascript"></script>
<script src="/Content/js/app.files.js?nocache=634409743120466301" type="text/javascript"></script>
<script src="/Content/js/jquery.ba-bbq.min.js?nocache=634409743120466301" type="text/javascript"></script>
<script src="/Content/js/jquery.ba-throttle-debounce.min.js?nocache=634409743120466301" type="text/javascript"></script>
<script src="/Content/js/jquery.tmpl.min.js?nocache=634409743120466301" type="text/javascript"></script>
<script src="/Content/js/modernizr-1.7.min.js?nocache=634409743120466301" type="text/javascript">script>

So, as you can see, even though I'm manually referencing the files in my _Layout.cshtml, and even though they are no longer referenced in app.files.js, somehow Knapsack is still adding them in there. It's like its not clearing its cache or something. Or perhaps I'm just doing something wrong.

andrewdavey commented 13 years ago

Thanks for reporting the issue. It's most likely a cache issue. I'll take a look into it.

andrewdavey commented 13 years ago

I've pushed a change to master that creates a CacheDependency on module directories. So file system changes will cause the Knapsack Manager object to be recreated. Please try it out and let me know if this fixes things for you. Thanks.